Move pf_is_depth_stencil() to u_format auxiliary module.
authorMichal Krol <michal@vmware.com>
Thu, 3 Dec 2009 09:12:47 +0000 (10:12 +0100)
committerMichal Krol <michal@vmware.com>
Thu, 3 Dec 2009 09:12:47 +0000 (10:12 +0100)
src/gallium/auxiliary/util/u_format.h
src/gallium/include/pipe/p_format.h
src/gallium/state_trackers/python/tests/base.py
src/gallium/state_trackers/xorg/xorg_dri2.c
src/mesa/state_tracker/st_cb_fbo.c
src/mesa/state_tracker/st_cb_texture.c

index 2931d2a8bbf53c27307597397f998bc2975c8b74..cd883d38ca866a63175d6783afdf1321a4ef1abb 100644 (file)
@@ -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.
index 3eb22ff077de00691bd48653a0f7cd7cdf21af7d..16ac95be9b68875b9cf9185dda04b05686fc76f2 100644 (file)
@@ -548,13 +548,6 @@ pf_get_2d_size(const struct pipe_format_block *block, size_t stride, unsigned he
    return pf_get_nblocksy(block, height)*stride;
 }
 
-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 )
 {
@@ -562,13 +555,6 @@ pf_is_depth_and_stencil( enum pipe_format format )
            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,
index 202ccfc35097fbf1e364c63fe34342cfa2012b05..b022d073fda815a77dae2be07fcf3bdf6df76a06 100755 (executable)
@@ -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,
index 2394f004d258410d83c9f1fd406d1140b5cebbed..36711609d2f38e5ab710c17aa29d13f146f8f4c6 100644 (file)
@@ -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:
index 659a6c91938aa26a00f7fd733e27c01065360d87..7ccdddb00bc1fd443878e48e2ede5c3f3a8a6ed1 100644 (file)
@@ -49,6 +49,7 @@
 #include "st_public.h"
 #include "st_texture.h"
 
+#include "util/u_format.h"
 #include "util/u_rect.h"
 
 
@@ -133,7 +134,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
       template.depth0 = 1;
       template.last_level = 0;
       template.nr_samples = rb->NumSamples;
-      if (pf_is_depth_stencil(format)) {
+      if (util_format_is_depth_or_stencil(format)) {
          template.tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL;
       }
       else {
index 2c5601c22b7457dde789d5a10418f7fcd510a5bb..676a7df6fdc5bf5f0709299b3824cb6b136ba9f5 100644 (file)
@@ -205,7 +205,7 @@ static GLuint
 default_usage(enum pipe_format fmt)
 {
    GLuint usage = PIPE_TEXTURE_USAGE_SAMPLER;
-   if (pf_is_depth_stencil(fmt))
+   if (util_format_is_depth_or_stencil(fmt))
       usage |= PIPE_TEXTURE_USAGE_DEPTH_STENCIL;
    else
       usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET;