aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary/util/u_format.h
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-06-18 08:28:35 +0200
committermarha <marha@users.sourceforge.net>2013-06-18 08:28:35 +0200
commit230fe896faed312ef22d915e871fb5aee3ecfad0 (patch)
tree971b0c0899c72496f97970319bfadfae383abbea /mesalib/src/gallium/auxiliary/util/u_format.h
parent180290f941da61bd80284d817e27c01cf789ee53 (diff)
parentb071050b9eda9d5e5185e582dbe9f4adba863ccc (diff)
downloadvcxsrv-230fe896faed312ef22d915e871fb5aee3ecfad0.tar.gz
vcxsrv-230fe896faed312ef22d915e871fb5aee3ecfad0.tar.bz2
vcxsrv-230fe896faed312ef22d915e871fb5aee3ecfad0.zip
Merge remote-tracking branch 'origin/released'
* origin/released: libX11 libXmu libxcb/xcb-proto mesa mkfontscale pixman xkeyboard-config git update 18 June 2013
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util/u_format.h')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_format.h b/mesalib/src/gallium/auxiliary/util/u_format.h
index e4b9c365c..4cace6ad1 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format.h
+++ b/mesalib/src/gallium/auxiliary/util/u_format.h
@@ -31,6 +31,7 @@
#include "pipe/p_format.h"
+#include "pipe/p_defines.h"
#include "util/u_debug.h"
union pipe_color_union;
@@ -520,6 +521,33 @@ util_format_is_depth_and_stencil(enum pipe_format format)
util_format_has_stencil(desc);
}
+/**
+ * Return whether this is an RGBA, Z, S, or combined ZS format.
+ * Useful for initializing pipe_blit_info::mask.
+ */
+static INLINE unsigned
+util_format_get_mask(enum pipe_format format)
+{
+ const struct util_format_description *desc =
+ util_format_description(format);
+
+ if (!desc)
+ return 0;
+
+ if (util_format_has_depth(desc)) {
+ if (util_format_has_stencil(desc)) {
+ return PIPE_MASK_ZS;
+ } else {
+ return PIPE_MASK_Z;
+ }
+ } else {
+ if (util_format_has_stencil(desc)) {
+ return PIPE_MASK_S;
+ } else {
+ return PIPE_MASK_RGBA;
+ }
+ }
+}
/**
* Give the RGBA colormask of the channels that can be represented in this