summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/util/u_format_pack.py
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2010-03-30 01:33:28 +0200
committerRoland Scheidegger <sroland@vmware.com>2010-03-30 01:33:28 +0200
commit4e9690f00ca67e42e31367c50f9c216ad10ef553 (patch)
tree312f0696dda3b20bcdc18f39408766dd7fe192fb /src/gallium/auxiliary/util/u_format_pack.py
parent9de2ee646ad09676817c558a6d02f5b2bb7bb173 (diff)
gallium: make the python scripts for format parsing not fail on new formats
they won't generate any useful conversion code for some of the new formats but at least don't assert. Also needed some more hacks so they don't generate code for some of the new formats, as gcc was not impressed. Also declare unused channels as void, and change the scripts to not fail if the first channel happened to be unused. Needs serious fixing.
Diffstat (limited to 'src/gallium/auxiliary/util/u_format_pack.py')
-rw-r--r--src/gallium/auxiliary/util/u_format_pack.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/util/u_format_pack.py b/src/gallium/auxiliary/util/u_format_pack.py
index 409d024c63..47def90317 100644
--- a/src/gallium/auxiliary/util/u_format_pack.py
+++ b/src/gallium/auxiliary/util/u_format_pack.py
@@ -46,11 +46,11 @@ def generate_format_type(format):
'''Generate a structure that describes the format.'''
print 'union util_format_%s {' % format.short_name()
- if format.is_bitmask():
+ if format.is_bitmask() or format.short_name() == "r11g11b10_float":
print ' uint%u_t value;' % (format.block_size(),)
print ' struct {'
for channel in format.channels:
- if format.is_bitmask() and not format.is_array():
+ if (format.is_bitmask() or format.is_mixed()) and not format.is_array() or format.short_name() == "r11g11b10_float":
if channel.type == VOID:
if channel.size:
print ' unsigned %s:%u;' % (channel.name, channel.size)
@@ -58,6 +58,11 @@ def generate_format_type(format):
print ' unsigned %s:%u;' % (channel.name, channel.size)
elif channel.type == SIGNED:
print ' int %s:%u;' % (channel.name, channel.size)
+ elif channel.type == FLOAT:
+ if channel.size == 32:
+ print ' float %s;' % (channel.name)
+ else:
+ print ' unsigned %s:%u;' % (channel.name, channel.size)
else:
assert 0
else:
@@ -107,6 +112,9 @@ def is_format_supported(format):
channel = format.channels[i]
if channel.type not in (VOID, UNSIGNED, SIGNED, FLOAT):
return False
+ if channel.type == FLOAT:
+ if channel.size not in (32, 64):
+ return False
# We can only read a color from a depth/stencil format if the depth channel is present
if format.colorspace == 'zs' and format.swizzles[0] == SWIZZLE_NONE:
@@ -125,6 +133,8 @@ def native_type(format):
else:
# For array pixel formats return the integer type that matches the color channel
type = format.channels[0]
+ if type.type == VOID:
+ type = format.channels[1]
if type.type == UNSIGNED:
return 'uint%u_t' % type.size
elif type.type == SIGNED: