mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 04:30:10 +01:00
u_format: Fix some pep8 in u_format_parse.py.
My editor likes to enforce pep8, here's some low hanging fruit so I don't have to do too much add -p. Acked-by: Adam Jackson <ajax@redhat.com> Acked-by: Ilia Mirkin <imirkin@alum.mit.edu> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10505>
This commit is contained in:
parent
b71e27ea84
commit
a7fdddb133
1 changed files with 10 additions and 9 deletions
|
|
@ -45,7 +45,7 @@ ZS = 'zs'
|
|||
|
||||
|
||||
def is_pot(x):
|
||||
return (x & (x - 1)) == 0
|
||||
return (x & (x - 1)) == 0
|
||||
|
||||
|
||||
VERY_LARGE = 99999999999999999999999
|
||||
|
|
@ -53,8 +53,8 @@ VERY_LARGE = 99999999999999999999999
|
|||
|
||||
class Channel:
|
||||
'''Describe the channel of a color channel.'''
|
||||
|
||||
def __init__(self, type, norm, pure, size, name = ''):
|
||||
|
||||
def __init__(self, type, norm, pure, size, name=''):
|
||||
self.type = type
|
||||
self.norm = norm
|
||||
self.pure = pure
|
||||
|
|
@ -93,7 +93,7 @@ class Channel:
|
|||
if self.type == SIGNED:
|
||||
return (1 << (self.size - 1)) - 1
|
||||
assert False
|
||||
|
||||
|
||||
def min(self):
|
||||
'''Minimum representable number.'''
|
||||
if self.type == FLOAT:
|
||||
|
|
@ -156,7 +156,7 @@ class Format:
|
|||
return None
|
||||
ref_channel = self.le_channels[0]
|
||||
if ref_channel.type == VOID:
|
||||
ref_channel = self.le_channels[1]
|
||||
ref_channel = self.le_channels[1]
|
||||
for channel in self.le_channels:
|
||||
if channel.size and (channel.size != ref_channel.size or channel.size % 8):
|
||||
return None
|
||||
|
|
@ -177,7 +177,7 @@ class Format:
|
|||
return False
|
||||
ref_channel = self.le_channels[0]
|
||||
if ref_channel.type == VOID:
|
||||
ref_channel = self.le_channels[1]
|
||||
ref_channel = self.le_channels[1]
|
||||
for channel in self.le_channels[1:]:
|
||||
if channel.type != VOID:
|
||||
if channel.type != ref_channel.type:
|
||||
|
|
@ -244,7 +244,7 @@ class Format:
|
|||
for channel in self.le_channels
|
||||
if channel.type != VOID]
|
||||
for x in pures:
|
||||
assert x == pures[0]
|
||||
assert x == pures[0]
|
||||
return pures[0]
|
||||
|
||||
def channel_type(self):
|
||||
|
|
@ -252,7 +252,7 @@ class Format:
|
|||
for channel in self.le_channels
|
||||
if channel.type != VOID]
|
||||
for x in types:
|
||||
assert x == types[0]
|
||||
assert x == types[0]
|
||||
return types[0]
|
||||
|
||||
def is_pure_signed(self):
|
||||
|
|
@ -293,6 +293,7 @@ _swizzle_parse_map = {
|
|||
'_': SWIZZLE_NONE,
|
||||
}
|
||||
|
||||
|
||||
def _parse_channels(fields, layout, colorspace, swizzles):
|
||||
if layout == PLAIN:
|
||||
names = ['']*4
|
||||
|
|
@ -341,6 +342,7 @@ def _parse_channels(fields, layout, colorspace, swizzles):
|
|||
|
||||
return channels
|
||||
|
||||
|
||||
def parse(filename):
|
||||
'''Parse the format description in CSV format in terms of the
|
||||
Channel and Format classes above.'''
|
||||
|
|
@ -391,4 +393,3 @@ def parse(filename):
|
|||
format = Format(name, layout, block_width, block_height, block_depth, le_channels, le_swizzles, be_channels, be_swizzles, colorspace)
|
||||
formats.append(format)
|
||||
return formats
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue