summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/util/u_format.h13
-rw-r--r--src/gallium/include/pipe/p_format.h14
-rwxr-xr-xsrc/gallium/state_trackers/python/tests/base.py2
-rw-r--r--src/gallium/state_trackers/xorg/xorg_dri2.c3
4 files changed, 16 insertions, 16 deletions
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index 2931d2a8bbf..cd883d38ca8 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -128,6 +128,19 @@ util_format_is_compressed(enum pipe_format format)
return desc->layout == UTIL_FORMAT_LAYOUT_DXT ? TRUE : FALSE;
}
+static INLINE boolean
+util_format_is_depth_or_stencil(enum pipe_format format)
+{
+ const struct util_format_description *desc = util_format_description(format);
+
+ assert(format);
+ if (!format) {
+ return FALSE;
+ }
+
+ return desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS ? TRUE : FALSE;
+}
+
/*
* Format access functions.
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index 3eb22ff077d..16ac95be9b6 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -549,26 +549,12 @@ pf_get_2d_size(const struct pipe_format_block *block, size_t stride, unsigned he
}
static INLINE boolean
-pf_is_depth_or_stencil( enum pipe_format format )
-{
- return (pf_get_component_bits( format, PIPE_FORMAT_COMP_Z ) +
- pf_get_component_bits( format, PIPE_FORMAT_COMP_S )) != 0;
-}
-
-static INLINE boolean
pf_is_depth_and_stencil( enum pipe_format format )
{
return (pf_get_component_bits( format, PIPE_FORMAT_COMP_Z ) != 0 &&
pf_get_component_bits( format, PIPE_FORMAT_COMP_S ) != 0);
}
-/** DEPRECATED: For backwards compatibility */
-static INLINE boolean
-pf_is_depth_stencil( enum pipe_format format )
-{
- return pf_is_depth_or_stencil( format );
-}
-
enum pipe_video_chroma_format
{
PIPE_VIDEO_CHROMA_FORMAT_420,
diff --git a/src/gallium/state_trackers/python/tests/base.py b/src/gallium/state_trackers/python/tests/base.py
index 202ccfc3509..b022d073fda 100755
--- a/src/gallium/state_trackers/python/tests/base.py
+++ b/src/gallium/state_trackers/python/tests/base.py
@@ -47,7 +47,7 @@ for name, value in globals().items():
formats[value] = name
def is_depth_stencil_format(format):
- # FIXME: make and use binding to pf_is_depth_stencil
+ # FIXME: make and use binding to util_format_is_depth_or_stencil
return format in (
PIPE_FORMAT_Z32_UNORM,
PIPE_FORMAT_Z24S8_UNORM,
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
index 2394f004d25..36711609d2f 100644
--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
@@ -40,6 +40,7 @@
#include "pipe/p_state.h"
#include "pipe/p_inlines.h"
+#include "util/u_format.h"
#include "util/u_rect.h"
/* Make all the #if cases in the code esier to read */
@@ -92,7 +93,7 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int form
case 9:
#endif
if (exa_priv->depth_stencil_tex &&
- !pf_is_depth_stencil(exa_priv->depth_stencil_tex->format))
+ !util_format_is_depth_or_stencil(exa_priv->depth_stencil_tex->format))
exa_priv->depth_stencil_tex = NULL;
/* Fall through */
case DRI2BufferDepth: