aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary/util/u_format.h
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-07-13 10:11:58 +0200
committermarha <marha@users.sourceforge.net>2012-07-13 10:11:58 +0200
commitf0a7d1d88be0c31bd471f4428c4493a93f2d9321 (patch)
tree15b5078011dc751f9c1a1bb21e51dc2e600ee205 /mesalib/src/gallium/auxiliary/util/u_format.h
parent165450290d6c26756ede118f52ba2164abce7c9a (diff)
downloadvcxsrv-f0a7d1d88be0c31bd471f4428c4493a93f2d9321.tar.gz
vcxsrv-f0a7d1d88be0c31bd471f4428c4493a93f2d9321.tar.bz2
vcxsrv-f0a7d1d88be0c31bd471f4428c4493a93f2d9321.zip
xserver mesa git update 13 Jul 2012
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util/u_format.h')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_format.h b/mesalib/src/gallium/auxiliary/util/u_format.h
index e35e164b4..a718389dd 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format.h
+++ b/mesalib/src/gallium/auxiliary/util/u_format.h
@@ -882,6 +882,35 @@ util_format_linear(enum pipe_format format)
}
/**
+ * Given a depth-stencil format, return the corresponding stencil-only format.
+ * For stencil-only formats, return the format unchanged.
+ */
+static INLINE enum pipe_format
+util_format_stencil_only(enum pipe_format format)
+{
+ switch (format) {
+ /* mask out the depth component */
+ case PIPE_FORMAT_Z24_UNORM_S8_UINT:
+ return PIPE_FORMAT_X24S8_UINT;
+ case PIPE_FORMAT_S8_UINT_Z24_UNORM:
+ return PIPE_FORMAT_S8X24_UINT;
+ case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
+ return PIPE_FORMAT_X32_S8X24_UINT;
+
+ /* stencil only formats */
+ case PIPE_FORMAT_X24S8_UINT:
+ case PIPE_FORMAT_S8X24_UINT:
+ case PIPE_FORMAT_X32_S8X24_UINT:
+ case PIPE_FORMAT_S8_UINT:
+ return format;
+
+ default:
+ assert(0);
+ return PIPE_FORMAT_NONE;
+ }
+}
+
+/**
* Return the number of components stored.
* Formats with block size != 1x1 will always have 1 component (the block).
*/