summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/formats.h
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2014-07-10 23:59:42 -0700
committerJason Ekstrand <[email protected]>2014-08-05 10:56:16 -0700
commit850fb0d1dca616179d3239a7b7bd94fe1979604c (patch)
tree55ba0e1b3f4f4d67a99c0a7905364e5fbcfc8317 /src/mesa/main/formats.h
parent55a929955fa683a4e59ffb730ae37b645d10ba49 (diff)
mesa/formats: Add layout and swizzle information
v2: Move the MESA_FORMAT_SWIZZLE enum to the top of the file Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main/formats.h')
-rw-r--r--src/mesa/main/formats.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index dc50bc83094..8b7dee4bebc 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -56,6 +56,29 @@ extern "C" {
*/
#define MAX_PIXEL_BYTES 16
+/**
+ * Specifies the layout of a pixel format. See the MESA_FORMAT
+ * documentation below.
+ */
+enum mesa_format_layout {
+ MESA_FORMAT_LAYOUT_ARRAY,
+ MESA_FORMAT_LAYOUT_PACKED,
+ MESA_FORMAT_LAYOUT_OTHER,
+};
+
+/**
+ * An enum representing different possible swizzling values. This is used
+ * to interpret the output of _mesa_get_format_swizzle
+ */
+enum {
+ MESA_FORMAT_SWIZZLE_X = 0,
+ MESA_FORMAT_SWIZZLE_Y = 1,
+ MESA_FORMAT_SWIZZLE_Z = 2,
+ MESA_FORMAT_SWIZZLE_W = 3,
+ MESA_FORMAT_SWIZZLE_ZERO = 4,
+ MESA_FORMAT_SWIZZLE_ONE = 5,
+ MESA_FORMAT_SWIZZLE_NONE = 6,
+};
/**
* Mesa texture/renderbuffer image formats.
@@ -419,6 +442,9 @@ _mesa_get_format_bits(mesa_format format, GLenum pname);
extern GLuint
_mesa_get_format_max_bits(mesa_format format);
+extern enum mesa_format_layout
+_mesa_get_format_layout(mesa_format format);
+
extern GLenum
_mesa_get_format_datatype(mesa_format format);
@@ -428,6 +454,9 @@ _mesa_get_format_base_format(mesa_format format);
extern void
_mesa_get_format_block_size(mesa_format format, GLuint *bw, GLuint *bh);
+extern void
+_mesa_get_format_swizzle(mesa_format format, uint8_t swizzle_out[4]);
+
extern GLboolean
_mesa_is_format_compressed(mesa_format format);