summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/util/u_format_parse.py
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-02-24 15:10:46 +0000
committerJosé Fonseca <jfonseca@vmware.com>2010-02-24 15:45:28 +0000
commit943314f38f1224d4929b41acc9ef8fde81ef9dbe (patch)
treeede17f202009205b595cf760c600ddf9a8faf231 /src/gallium/auxiliary/util/u_format_parse.py
parenta9395360f2fd113beac759ca642d48588e0846f9 (diff)
util: Factor out the code to shorten a format name.
Diffstat (limited to 'src/gallium/auxiliary/util/u_format_parse.py')
-rwxr-xr-xsrc/gallium/auxiliary/util/u_format_parse.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_format_parse.py b/src/gallium/auxiliary/util/u_format_parse.py
index 37336029d8..248a26ea8c 100755
--- a/src/gallium/auxiliary/util/u_format_parse.py
+++ b/src/gallium/auxiliary/util/u_format_parse.py
@@ -77,6 +77,16 @@ class Format:
def __str__(self):
return self.name
+ def short_name(self):
+ '''Make up a short norm for a format, suitable to be used as suffix in
+ function names.'''
+
+ name = self.name
+ if name.startswith('PIPE_FORMAT_'):
+ name = name[len('PIPE_FORMAT_'):]
+ name = name.lower()
+ return name
+
def block_size(self):
size = 0
for type in self.in_types: