summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_tile_soa.py
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-02-26 16:45:22 +0000
committerJosé Fonseca <jfonseca@vmware.com>2010-02-26 16:46:34 +0000
commit9beb302212a2afac408016cbd7b93c8b859e4910 (patch)
tree042dcd52d6b20d233313de8c0bc093e00959daff /src/gallium/drivers/llvmpipe/lp_tile_soa.py
parent4757325951e35460975e77d70dacf8b6eb10ab11 (diff)
util: Code generate functions to pack and unpack a single pixel.
Should work correctly for all pixel formats except SRGB formats. Generated code made much simpler by defining the pixel format as a C structure. For example this is the generated structure for PIPE_FORMAT_B6UG5SR5S_NORM: union util_format_b6ug5sr5s_norm { uint16_t value; struct { int r:5; int g:5; unsigned b:6; } chan; }; Not used everywhere yet because it seems compiled code is slower than bitshift arithmetic by some misterious reason. So we should generate bitshift arithmetic at least for the simple UNORM pixel formats.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_tile_soa.py')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_tile_soa.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_tile_soa.py b/src/gallium/drivers/llvmpipe/lp_tile_soa.py
index dc44d67d63..00b8d4fc38 100644
--- a/src/gallium/drivers/llvmpipe/lp_tile_soa.py
+++ b/src/gallium/drivers/llvmpipe/lp_tile_soa.py
@@ -90,7 +90,7 @@ def generate_format_read(format, dst_channel, dst_native_type, dst_suffix):
value = '(%s >> %u)' % (value, shift)
if shift + width < format.block_size():
value = '(%s & 0x%x)' % (value, mask)
- value = conversion_expr(src_channel, dst_channel, dst_native_type, value)
+ value = conversion_expr(src_channel, dst_channel, dst_native_type, value, clamp=False)
print ' %s %s = %s;' % (dst_native_type, names[i], value)
shift += width
else:
@@ -98,7 +98,7 @@ def generate_format_read(format, dst_channel, dst_native_type, dst_suffix):
src_channel = format.channels[i]
if names[i]:
value = '(*src_pixel++)'
- value = conversion_expr(src_channel, dst_channel, dst_native_type, value)
+ value = conversion_expr(src_channel, dst_channel, dst_native_type, value, clamp=False)
print ' %s %s = %s;' % (dst_native_type, names[i], value)
else:
assert False
@@ -154,7 +154,7 @@ def pack_rgba(format, src_channel, r, g, b, a):
if value:
dst_channel = format.channels[i]
dst_native_type = native_type(format)
- value = conversion_expr(src_channel, dst_channel, dst_native_type, value)
+ value = conversion_expr(src_channel, dst_channel, dst_native_type, value, clamp=False)
term = "((%s) << %d)" % (value, shift)
if expr:
expr = expr + " | " + term
@@ -217,7 +217,7 @@ def emit_tile_pixel_write_code(format, src_channel):
width = dst_channel.size
if inv_swizzle[i] is not None:
value = 'TILE_PIXEL(src, x, y, %u)' % inv_swizzle[i]
- value = conversion_expr(src_channel, dst_channel, dst_native_type, value)
+ value = conversion_expr(src_channel, dst_channel, dst_native_type, value, clamp=False)
if shift:
value = '(%s << %u)' % (value, shift)
print ' pixel |= %s;' % value
@@ -228,7 +228,7 @@ def emit_tile_pixel_write_code(format, src_channel):
dst_channel = format.channels[i]
if inv_swizzle[i] is not None:
value = 'TILE_PIXEL(src, x, y, %u)' % inv_swizzle[i]
- value = conversion_expr(src_channel, dst_channel, dst_native_type, value)
+ value = conversion_expr(src_channel, dst_channel, dst_native_type, value, clamp=False)
print ' *dst_pixel++ = %s;' % value
else:
assert False