summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2010-02-26 10:11:36 +0000
committerJosé Fonseca <[email protected]>2010-02-26 10:12:53 +0000
commite2b02ea9db1a01fd2c4e431edff237d9909863ef (patch)
tree74502056438919cf74022f5429b3b8bfb65c5104 /src/gallium
parent0c20b3033309f5d71af835b4eb5680ec7384e1f7 (diff)
util: Add is_pot() method to formats.
Diffstat (limited to 'src/gallium')
-rwxr-xr-xsrc/gallium/auxiliary/util/u_format_parse.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_format_parse.py b/src/gallium/auxiliary/util/u_format_parse.py
index 15c887af5e6..f26cb372373 100755
--- a/src/gallium/auxiliary/util/u_format_parse.py
+++ b/src/gallium/auxiliary/util/u_format_parse.py
@@ -37,6 +37,10 @@ SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W, SWIZZLE_0, SWIZZLE_1, SWIZZLE_NONE,
PLAIN = 'plain'
+def is_pot(x):
+ return (x & (x - 1)) == 0;
+
+
class Type:
'''Describe the type of a color channel.'''
@@ -113,6 +117,9 @@ class Format:
return True
return False
+ def is_pot(self):
+ return is_pot(self.block_size())
+
def stride(self):
return self.block_size()/8