summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Barbieri <luca@luca-barbieri.com>2010-04-01 06:17:10 +0200
committerLuca Barbieri <luca@luca-barbieri.com>2010-04-01 06:23:30 +0200
commit732685175773e3fce2e72836264e2081978e16fb (patch)
tree390df2bfad4cb2753f57f383c78d664b48164dff
parent2fb655d1dbb3f8425aeff1597271262661ef206b (diff)
util/format: fix big endian compilation by not trying to byteswap single bytes
Conceivably, we could also have a dummy util_bswap8, but it seems better to not emit it in the first place.
-rw-r--r--src/gallium/auxiliary/util/u_format_pack.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/gallium/auxiliary/util/u_format_pack.py b/src/gallium/auxiliary/util/u_format_pack.py
index 95c0c79be9..90c1ae9e21 100644
--- a/src/gallium/auxiliary/util/u_format_pack.py
+++ b/src/gallium/auxiliary/util/u_format_pack.py
@@ -147,7 +147,7 @@ def generate_srgb_tables():
def bswap_format(format):
'''Generate a structure that describes the format.'''
- if format.is_bitmask() and not format.is_array():
+ if format.is_bitmask() and not format.is_array() and format.block_size() > 8:
print '#ifdef PIPE_ARCH_BIG_ENDIAN'
print ' pixel.value = util_bswap%u(pixel.value);' % format.block_size()
print '#endif'
@@ -353,9 +353,10 @@ def generate_unpack_kernel(format, dst_channel, dst_native_type):
elif src_channel.type == SIGNED:
print ' int%u_t %s;' % (depth, src_channel.name)
- print '#ifdef PIPE_ARCH_BIG_ENDIAN'
- print ' value = util_bswap%u(value);' % depth
- print '#endif'
+ if depth > 8:
+ print '#ifdef PIPE_ARCH_BIG_ENDIAN'
+ print ' value = util_bswap%u(value);' % depth
+ print '#endif'
# Compute the intermediate unshifted values
shift = 0
@@ -476,9 +477,10 @@ def generate_pack_kernel(format, src_channel, src_native_type):
shift += dst_channel.size
- print '#ifdef PIPE_ARCH_BIG_ENDIAN'
- print ' value = util_bswap%u(value);' % depth
- print '#endif'
+ if depth > 8:
+ print '#ifdef PIPE_ARCH_BIG_ENDIAN'
+ print ' value = util_bswap%u(value);' % depth
+ print '#endif'
print ' *(uint%u_t *)dst = value;' % depth