Mesa (master): llvmpipe: Fix (un)swizzling, broken due to use of VOID channels.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Thu Apr 1 10:36:42 UTC 2010


Module: Mesa
Branch: master
Commit: 898ddd6b00ffbb515c83025b1e51092752c182a7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=898ddd6b00ffbb515c83025b1e51092752c182a7

Author: José Fonseca <jfonseca at vmware.com>
Date:   Thu Apr  1 11:31:03 2010 +0100

llvmpipe: Fix (un)swizzling, broken due to use of VOID channels.

---

 src/gallium/drivers/llvmpipe/lp_tile_soa.py |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_tile_soa.py b/src/gallium/drivers/llvmpipe/lp_tile_soa.py
index 6a3ede0..4157000 100644
--- a/src/gallium/drivers/llvmpipe/lp_tile_soa.py
+++ b/src/gallium/drivers/llvmpipe/lp_tile_soa.py
@@ -95,11 +95,16 @@ def generate_format_read(format, dst_channel, dst_native_type, dst_suffix):
                 shift += width
         else:
             for i in range(4):
+                if names[i]:
+                    print '         %s %s;' % (dst_native_type, names[i])
+            for i in range(4):
                 src_channel = format.channels[i]
                 if names[i]:
                     value = '(*src_pixel++)'
                     value = conversion_expr(src_channel, dst_channel, dst_native_type, value, clamp=False)
-                    print '         %s %s = %s;' % (dst_native_type, names[i], value)
+                    print '         %s = %s;' % (names[i], value)
+                elif src_channel.size:
+                    print '         ++src_pixel;'
     else:
         assert False
 
@@ -230,6 +235,8 @@ def emit_tile_pixel_write_code(format, src_channel):
                     value = 'TILE_PIXEL(src, x, y, %u)' % inv_swizzle[i]
                     value = conversion_expr(src_channel, dst_channel, dst_native_type, value, clamp=False)
                     print '         *dst_pixel++ = %s;' % value
+                else:
+                    print '         ++dst_pixel;'
     else:
         assert False
 
@@ -251,7 +258,8 @@ def generate_format_write(format, src_channel, src_native_type, src_suffix):
         and format.block_size() <= 32 \
         and format.is_pot() \
         and not format.is_mixed() \
-        and format.channels[0].type == UNSIGNED:
+        and (format.channels[0].type == UNSIGNED \
+             or format.channels[1].type == UNSIGNED):
         emit_unrolled_write_code(format, src_channel)
     else:
         emit_tile_pixel_write_code(format, src_channel)




More information about the mesa-commit mailing list