Module: Mesa
Branch: master
Commit: cfde6c50ae6c3ce7912a3d1231c459d020d77f13
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cfde6c50ae6c3ce7912a3d1231c459d020d77f13

Author: José Fonseca <[email protected]>
Date:   Sat Mar  6 12:48:39 2010 +0000

util: Add a new flag, for formats that can be described as a bitmask.

---

 src/gallium/auxiliary/util/u_format.h        |    9 +++++++++
 src/gallium/auxiliary/util/u_format_parse.py |    8 +-------
 src/gallium/auxiliary/util/u_format_table.py |    2 ++
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_format.h 
b/src/gallium/auxiliary/util/u_format.h
index ec6b077..b2aa5bf 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -146,6 +146,15 @@ struct util_format_description
    unsigned is_array:1;
 
    /**
+    * Whether the pixel format can be described as a bitfield structure.
+    *
+    * In particular:
+    * - pixel depth must be 8, 16, or 32 bits;
+    * - all channels must be unsigned, signed, or void
+    */
+   unsigned is_bitmask:1;
+
+   /**
     * Whether channels have mixed types (ignoring UTIL_FORMAT_TYPE_VOID).
     */
    unsigned is_mixed:1;
diff --git a/src/gallium/auxiliary/util/u_format_parse.py 
b/src/gallium/auxiliary/util/u_format_parse.py
index 2509264..80bae6f 100755
--- a/src/gallium/auxiliary/util/u_format_parse.py
+++ b/src/gallium/auxiliary/util/u_format_parse.py
@@ -166,17 +166,11 @@ class Format:
         return True
 
     def is_bitmask(self):
-        if self.block_size() > 32:
-            return False
-        if not self.is_pot():
+        if self.block_size() not in (8, 16, 32):
             return False
         for channel in self.channels:
-            if not is_pot(channel.size):
-                return True
             if channel.type not in (VOID, UNSIGNED, SIGNED):
                 return False
-            if channel.size >= 32:
-                return False
         return True
 
     def inv_swizzles(self):
diff --git a/src/gallium/auxiliary/util/u_format_table.py 
b/src/gallium/auxiliary/util/u_format_table.py
index f9d21ed..fb68852 100755
--- a/src/gallium/auxiliary/util/u_format_table.py
+++ b/src/gallium/auxiliary/util/u_format_table.py
@@ -96,6 +96,7 @@ def write_format_table(formats):
     print "   0,"
     print "   0,"
     print "   0,"
+    print "   0,"
     print "   {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},"
     print "   {0, 0, 0, 0},"
     print "   0"
@@ -111,6 +112,7 @@ def write_format_table(formats):
         print "   %s," % (layout_map(format.layout),)
         print "   %u,\t/* nr_channels */" % (format.nr_channels(),)
         print "   %s,\t/* is_array */" % (bool_map(format.is_array()),)
+        print "   %s,\t/* is_bitmask */" % (bool_map(format.is_bitmask()),)
         print "   %s,\t/* is_mixed */" % (bool_map(format.is_mixed()),)
         print "   {"
         for i in range(4):

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to