diff options
author | Dave Airlie <[email protected]> | 2011-09-19 15:04:48 +0100 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2011-10-08 17:44:59 +0100 |
commit | a441feb757b1be4845ba378f0207dcdc5cc1a407 (patch) | |
tree | 63a6b44c082a8850a0001fa8e772d58042123dc4 /src/gallium/auxiliary/util/u_format_parse.py | |
parent | c2060c0af7de4678d55962369244451fe678c4e8 (diff) |
gallium: add initial pure integer support (v2)
This add support for unsigned/signed integer types via adding a 'pure' bit
in the format description table. It adds 4 new u_format get/put hooks,
for get/put uint and get/put sint so that accessors can get native access
to the integer bits. This is used to avoid precision loss via float converting
paths.
It doesn't add any float fetchers for these types at the moment, GL doesn't
require float fetching from these types and I expect we'll introduce a lot
of hidden bugs if we start allowing such conversions without an API mandating
it.
It adds all formats from EXT_texture_integer and EXT_texture_rg.
0 regressions on llvmpipe here with this.
(there is some more follow on code in my gallium-int-work branch, bringing
softpipe and mesa to a pretty integer clean state)
v2: fixup python generator to get signed->unsigned and unsigned->signed
fetches working.
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util/u_format_parse.py')
-rwxr-xr-x | src/gallium/auxiliary/util/u_format_parse.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/util/u_format_parse.py b/src/gallium/auxiliary/util/u_format_parse.py index ddb9f2443d9..73a4bcb2100 100755 --- a/src/gallium/auxiliary/util/u_format_parse.py +++ b/src/gallium/auxiliary/util/u_format_parse.py @@ -52,9 +52,10 @@ VERY_LARGE = 99999999999999999999999 class Channel: '''Describe the channel of a color channel.''' - def __init__(self, type, norm, size, name = ''): + def __init__(self, type, norm, pure, size, name = ''): self.type = type self.norm = norm + self.pure = pure self.size = size self.sign = type in (SIGNED, FIXED, FLOAT) self.name = name @@ -63,11 +64,13 @@ class Channel: s = str(self.type) if self.norm: s += 'n' + if self.pure: + s += 'p' s += str(self.size) return s def __eq__(self, other): - return self.type == other.type and self.norm == other.norm and self.size == other.size + return self.type == other.type and self.norm == other.norm and self.pure == other.pure and self.size == other.size def max(self): '''Maximum representable number.''' @@ -158,6 +161,8 @@ class Format: return True if channel.norm != ref_channel.norm: return True + if channel.pure != ref_channel.pure: + return True return False def is_pot(self): @@ -274,15 +279,22 @@ def parse(filename): type = _type_parse_map[field[0]] if field[1] == 'n': norm = True + pure = False + size = int(field[2:]) + elif field[1] == 'p': + pure = True + norm = False size = int(field[2:]) else: norm = False + pure = False size = int(field[1:]) else: type = VOID norm = False + pure = False size = 0 - channel = Channel(type, norm, size, names[i]) + channel = Channel(type, norm, pure, size, names[i]) channels.append(channel) format = Format(name, layout, block_width, block_height, channels, swizzles, colorspace) |