[Mesa-dev] [PATCH 04/14] gallium: Document packed formats

Adam Jackson ajax at redhat.com
Tue Jun 18 10:28:05 PDT 2013


Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 src/gallium/docs/format.rst | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/gallium/docs/format.rst b/src/gallium/docs/format.rst
index 2514656..e270d93 100644
--- a/src/gallium/docs/format.rst
+++ b/src/gallium/docs/format.rst
@@ -6,7 +6,14 @@ Gallium format names mostly follow D3D10 conventions, with some extensions.
 Format names like XnYnZnWn have the X component in the lowest-address n bits
 and the W component in the highest-address n bits; for B8G8R8A8, byte 0 is
 blue and byte 3 is alpha.  Note that platform endianness is not considered
-in this definition.
+in this definition.  In C:
+
+    struct xyzw8888 { uint8_t x, y, z, w; };
+
+Format aliases like XYZWstrq are (s+t+r+q)-bit integers in host endianness,
+with the X component in the s least-significant bits of the integer.  In C:
+
+    uint32_t xyzw8888 = (x << 0) | (y << 8) | (z << 16) | (w << 24);
 
 Format suffixes affect the interpretation of the channel:
 
-- 
1.8.2.1



More information about the mesa-dev mailing list