projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0c20b30
)
util: Add is_pot() method to formats.
author
José Fonseca
<jfonseca@vmware.com>
Fri, 26 Feb 2010 10:11:36 +0000
(10:11 +0000)
committer
José Fonseca
<jfonseca@vmware.com>
Fri, 26 Feb 2010 10:12:53 +0000
(10:12 +0000)
src/gallium/auxiliary/util/u_format_parse.py
patch
|
blob
|
history
diff --git
a/src/gallium/auxiliary/util/u_format_parse.py
b/src/gallium/auxiliary/util/u_format_parse.py
index 15c887af5e697491d493cc69803a597007dbfe75..f26cb3723738d050d1cb54bbed119e1c07565ce0 100755
(executable)
--- 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