[Mesa-dev] [PATCH 8/8] util: Add a shift field to the channel structure

Richard Sandiford rsandifo at linux.vnet.ibm.com
Wed Jun 12 03:56:45 PDT 2013


The new field eats up all the remaining bits of the bitfield,
but it could easily be shrunk in future.

Signed-off-by: Richard Sandiford <rsandifo at linux.vnet.ibm.com>
---
 src/gallium/auxiliary/util/u_format.h        | 1 +
 src/gallium/auxiliary/util/u_format_table.py | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index db6c290..df8263b 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -132,6 +132,7 @@ struct util_format_channel_description
    unsigned normalized:1;
    unsigned pure_integer:1;
    unsigned size:9;        /**< bits per channel */
+   unsigned shift:16;      /**< number of bits from lsb */
 };
 
 
diff --git a/src/gallium/auxiliary/util/u_format_table.py b/src/gallium/auxiliary/util/u_format_table.py
index 2d9752e..81fd399 100755
--- a/src/gallium/auxiliary/util/u_format_table.py
+++ b/src/gallium/auxiliary/util/u_format_table.py
@@ -103,9 +103,9 @@ def write_format_table(formats):
             else:
                 sep = ""
             if channel.size:
-                print "      {%s, %s, %s, %u}%s\t/* %s = %s */" % (type_map[channel.type], bool_map(channel.norm), bool_map(channel.pure), channel.size, sep, "xyzw"[i], channel.name)
+                print "      {%s, %s, %s, %u, %u}%s\t/* %s = %s */" % (type_map[channel.type], bool_map(channel.norm), bool_map(channel.pure), channel.size, channel.shift, sep, "xyzw"[i], channel.name)
             else:
-                print "      {0, 0, 0, 0}%s" % (sep,)
+                print "      {0, 0, 0, 0, 0}%s" % (sep,)
         print "   },"
 
     def do_swizzle_array(channels, swizzles):
-- 
1.7.11.7



More information about the mesa-dev mailing list