mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 07:18:17 +02:00
util: Add is_pot() method to formats.
This commit is contained in:
parent
0c20b30333
commit
e2b02ea9db
1 changed files with 7 additions and 0 deletions
|
|
@ -37,6 +37,10 @@ SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W, SWIZZLE_0, SWIZZLE_1, SWIZZLE_NONE,
|
||||||
PLAIN = 'plain'
|
PLAIN = 'plain'
|
||||||
|
|
||||||
|
|
||||||
|
def is_pot(x):
|
||||||
|
return (x & (x - 1)) == 0;
|
||||||
|
|
||||||
|
|
||||||
class Type:
|
class Type:
|
||||||
'''Describe the type of a color channel.'''
|
'''Describe the type of a color channel.'''
|
||||||
|
|
||||||
|
|
@ -113,6 +117,9 @@ class Format:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def is_pot(self):
|
||||||
|
return is_pot(self.block_size())
|
||||||
|
|
||||||
def stride(self):
|
def stride(self):
|
||||||
return self.block_size()/8
|
return self.block_size()/8
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue