summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/util/u_format_parse.py
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-02-23 19:51:42 +0000
committerJosé Fonseca <jfonseca@vmware.com>2010-02-24 12:15:13 +0000
commit5dce9b252b65102ed69956fdd47862d5cb1c4af1 (patch)
tree32c7a22674c3eaac5dbd127ae2c872bdd05bde92 /src/gallium/auxiliary/util/u_format_parse.py
parent3f5bac8960a5c6d1f08f0dc849676139b9d6ce5c (diff)
util: Store more derived data in the the format description.
Diffstat (limited to 'src/gallium/auxiliary/util/u_format_parse.py')
-rwxr-xr-xsrc/gallium/auxiliary/util/u_format_parse.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_format_parse.py b/src/gallium/auxiliary/util/u_format_parse.py
index 493aff7112..5d49fc7652 100755
--- a/src/gallium/auxiliary/util/u_format_parse.py
+++ b/src/gallium/auxiliary/util/u_format_parse.py
@@ -83,6 +83,30 @@ class Format:
size += type.size
return size
+ def nr_channels(self):
+ nr_channels = 0
+ for type in self.in_types:
+ if type.size:
+ nr_channels += 1
+ return nr_channels
+
+ def is_array(self):
+ ref_type = self.in_types[0]
+ for type in self.in_types[1:]:
+ if type.size and (type.size != ref_type.size or type.size % 8):
+ return False
+ return True
+
+ def is_mixed(self):
+ ref_type = self.in_types[0]
+ for type in self.in_types[1:]:
+ if type.kind != VOID:
+ if type.kind != ref_type.kind:
+ return True
+ if type.norm != ref_type.norm:
+ return True
+ return False
+
def stride(self):
return self.block_size()/8