util/u_format: Tighten the meaning of is_array bit to exclude mixed type formats.
authorJosé Fonseca <jfonseca@vmware.com>
Wed, 28 Nov 2012 19:18:09 +0000 (19:18 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Thu, 29 Nov 2012 14:08:42 +0000 (14:08 +0000)
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@vmware.com>
src/gallium/auxiliary/util/u_format.h
src/gallium/auxiliary/util/u_format_parse.py

index 25bfd234b9a007a3d44ba426d897a0fbc4877a26..ec368fd75def8b67d040a607d286865ba5878f39 100644 (file)
@@ -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;
 
index 3a39e5ba5242d72380823feeb6a53bf1acd52bae..07052b996661f86521f77a72673f55f855cbcccd 100755 (executable)
@@ -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):