Mesa (master): util/u_format: Tighten the meaning of is_array bit to exclude mixed type formats.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Thu Nov 29 14:09:06 UTC 2012


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

Author: José Fonseca <jfonseca at vmware.com>
Date:   Wed Nov 28 19:18:09 2012 +0000

util/u_format: Tighten the meaning of is_array bit to exclude mixed type formats.

This is what we want in practice.

The only change is in PIPE_FORMAT_R8SG8SB8UX8U_NORM, which no longer is
considered an array format.

Reviewed-by: Roland Scheidegger <sroland at vmware.com>

---

 src/gallium/auxiliary/util/u_format.h        |    2 +-
 src/gallium/auxiliary/util/u_format_parse.py |   11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index 25bfd23..ec368fd 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -156,7 +156,7 @@ struct util_format_description
    unsigned nr_channels:3;
 
    /**
-    * Whether all channels have the same number of (whole) bytes.
+    * Whether all channels have the same number of (whole) bytes and type.
     */
    unsigned is_array:1;
 
diff --git a/src/gallium/auxiliary/util/u_format_parse.py b/src/gallium/auxiliary/util/u_format_parse.py
index 3a39e5b..07052b9 100755
--- a/src/gallium/auxiliary/util/u_format_parse.py
+++ b/src/gallium/auxiliary/util/u_format_parse.py
@@ -144,9 +144,18 @@ class Format:
         if self.layout != PLAIN:
             return False
         ref_channel = self.channels[0]
-        for channel in self.channels[1:]:
+        if ref_channel.type == VOID:
+           ref_channel = self.channels[1]
+        for channel in self.channels:
             if channel.size and (channel.size != ref_channel.size or channel.size % 8):
                 return False
+            if channel.type != VOID:
+                if channel.type != ref_channel.type:
+                    return False
+                if channel.norm != ref_channel.norm:
+                    return False
+                if channel.pure != ref_channel.pure:
+                    return False
         return True
 
     def is_mixed(self):




More information about the mesa-commit mailing list