aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary/util/u_format.h
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-02-13 09:10:55 +0100
committermarha <marha@users.sourceforge.net>2013-02-13 09:10:55 +0100
commit8add148a4cf71b8bdab05a6b7e14824b5062da5e (patch)
tree8e1c46d5e3884612833ae099806391c5db4d3792 /mesalib/src/gallium/auxiliary/util/u_format.h
parent8753441b3ba4316448e1ae5f408e6a84b0116a3c (diff)
downloadvcxsrv-8add148a4cf71b8bdab05a6b7e14824b5062da5e.tar.gz
vcxsrv-8add148a4cf71b8bdab05a6b7e14824b5062da5e.tar.bz2
vcxsrv-8add148a4cf71b8bdab05a6b7e14824b5062da5e.zip
mesa pixman xserver git update 13 Feb 2013
xserver commit 7115f6c709898a5124b67e19c61dc01334471358 pixman commit 5e207f825bd1ed3142a623bcbceca00508907c5e mesa commit 8cabe26f5dc4c66ae59649cfd7b25f761cda250b
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util/u_format.h')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format.h117
1 files changed, 117 insertions, 0 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_format.h b/mesalib/src/gallium/auxiliary/util/u_format.h
index 63015dd50..00301265d 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format.h
+++ b/mesalib/src/gallium/auxiliary/util/u_format.h
@@ -888,6 +888,123 @@ util_format_stencil_only(enum pipe_format format)
}
/**
+ * Converts PIPE_FORMAT_*I* to PIPE_FORMAT_*R*.
+ * This is identity for non-intensity formats.
+ */
+static INLINE enum pipe_format
+util_format_intensity_to_red(enum pipe_format format)
+{
+ switch (format) {
+ case PIPE_FORMAT_I8_UNORM:
+ return PIPE_FORMAT_R8_UNORM;
+ case PIPE_FORMAT_I8_SNORM:
+ return PIPE_FORMAT_R8_SNORM;
+ case PIPE_FORMAT_I16_UNORM:
+ return PIPE_FORMAT_R16_UNORM;
+ case PIPE_FORMAT_I16_SNORM:
+ return PIPE_FORMAT_R16_SNORM;
+ case PIPE_FORMAT_I16_FLOAT:
+ return PIPE_FORMAT_R16_FLOAT;
+ case PIPE_FORMAT_I32_FLOAT:
+ return PIPE_FORMAT_R32_FLOAT;
+ case PIPE_FORMAT_I8_UINT:
+ return PIPE_FORMAT_R8_UINT;
+ case PIPE_FORMAT_I8_SINT:
+ return PIPE_FORMAT_R8_SINT;
+ case PIPE_FORMAT_I16_UINT:
+ return PIPE_FORMAT_R16_UINT;
+ case PIPE_FORMAT_I16_SINT:
+ return PIPE_FORMAT_R16_SINT;
+ case PIPE_FORMAT_I32_UINT:
+ return PIPE_FORMAT_R32_UINT;
+ case PIPE_FORMAT_I32_SINT:
+ return PIPE_FORMAT_R32_SINT;
+ default:
+ assert(!util_format_is_intensity(format));
+ return format;
+ }
+}
+
+/**
+ * Converts PIPE_FORMAT_*L* to PIPE_FORMAT_*R*.
+ * This is identity for non-luminance formats.
+ */
+static INLINE enum pipe_format
+util_format_luminance_to_red(enum pipe_format format)
+{
+ switch (format) {
+ case PIPE_FORMAT_L8_UNORM:
+ return PIPE_FORMAT_R8_UNORM;
+ case PIPE_FORMAT_L8_SNORM:
+ return PIPE_FORMAT_R8_SNORM;
+ case PIPE_FORMAT_L16_UNORM:
+ return PIPE_FORMAT_R16_UNORM;
+ case PIPE_FORMAT_L16_SNORM:
+ return PIPE_FORMAT_R16_SNORM;
+ case PIPE_FORMAT_L16_FLOAT:
+ return PIPE_FORMAT_R16_FLOAT;
+ case PIPE_FORMAT_L32_FLOAT:
+ return PIPE_FORMAT_R32_FLOAT;
+ case PIPE_FORMAT_L8_UINT:
+ return PIPE_FORMAT_R8_UINT;
+ case PIPE_FORMAT_L8_SINT:
+ return PIPE_FORMAT_R8_SINT;
+ case PIPE_FORMAT_L16_UINT:
+ return PIPE_FORMAT_R16_UINT;
+ case PIPE_FORMAT_L16_SINT:
+ return PIPE_FORMAT_R16_SINT;
+ case PIPE_FORMAT_L32_UINT:
+ return PIPE_FORMAT_R32_UINT;
+ case PIPE_FORMAT_L32_SINT:
+ return PIPE_FORMAT_R32_SINT;
+
+ case PIPE_FORMAT_LATC1_UNORM:
+ return PIPE_FORMAT_RGTC1_UNORM;
+ case PIPE_FORMAT_LATC1_SNORM:
+ return PIPE_FORMAT_RGTC1_SNORM;
+
+ case PIPE_FORMAT_L4A4_UNORM:
+ /* XXX A4R4 is defined as x00y in u_format.csv */
+ return PIPE_FORMAT_A4R4_UNORM;
+
+ case PIPE_FORMAT_L8A8_UNORM:
+ return PIPE_FORMAT_R8A8_UNORM;
+ case PIPE_FORMAT_L8A8_SNORM:
+ return PIPE_FORMAT_R8A8_SNORM;
+ case PIPE_FORMAT_L16A16_UNORM:
+ return PIPE_FORMAT_R16A16_UNORM;
+ case PIPE_FORMAT_L16A16_SNORM:
+ return PIPE_FORMAT_R16A16_SNORM;
+ case PIPE_FORMAT_L16A16_FLOAT:
+ return PIPE_FORMAT_R16A16_FLOAT;
+ case PIPE_FORMAT_L32A32_FLOAT:
+ return PIPE_FORMAT_R32A32_FLOAT;
+ case PIPE_FORMAT_L8A8_UINT:
+ return PIPE_FORMAT_R8A8_UINT;
+ case PIPE_FORMAT_L8A8_SINT:
+ return PIPE_FORMAT_R8A8_SINT;
+ case PIPE_FORMAT_L16A16_UINT:
+ return PIPE_FORMAT_R16A16_UINT;
+ case PIPE_FORMAT_L16A16_SINT:
+ return PIPE_FORMAT_R16A16_SINT;
+ case PIPE_FORMAT_L32A32_UINT:
+ return PIPE_FORMAT_R32A32_UINT;
+ case PIPE_FORMAT_L32A32_SINT:
+ return PIPE_FORMAT_R32A32_SINT;
+
+ /* We don't have compressed red-alpha variants for these. */
+ case PIPE_FORMAT_LATC2_UNORM:
+ case PIPE_FORMAT_LATC2_SNORM:
+ return PIPE_FORMAT_NONE;
+
+ default:
+ assert(!util_format_is_luminance(format) &&
+ !util_format_is_luminance_alpha(format));
+ return format;
+ }
+}
+
+/**
* Return the number of components stored.
* Formats with block size != 1x1 will always have 1 component (the block).
*/