From 37f4c2f906c8e2a6df609a190e4ca9ff028b265b Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 1 Jul 2010 18:27:39 +0100 Subject: gallivm: Fix 4 x unorm8 -> 4 x float conversion. Also fix the test. --- src/gallium/auxiliary/gallivm/lp_bld_conv.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/gallium/auxiliary/gallivm/lp_bld_conv.c') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_conv.c b/src/gallium/auxiliary/gallivm/lp_bld_conv.c index 5e7260dc21..44428f884d 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_conv.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_conv.c @@ -330,15 +330,24 @@ lp_build_conv(LLVMBuilderRef builder, /* * Truncate or expand bit width + * + * No data conversion should happen here, although the sign bits are + * crucial to avoid bad clamping. */ - assert(!tmp_type.floating || tmp_type.width == dst_type.width); + { + struct lp_type new_type; + + new_type = tmp_type; + new_type.sign = dst_type.sign; + new_type.width = dst_type.width; + new_type.length = dst_type.length; - lp_build_resize(builder, tmp_type, dst_type, tmp, num_srcs, tmp, num_dsts); + lp_build_resize(builder, tmp_type, new_type, tmp, num_srcs, tmp, num_dsts); - tmp_type.width = dst_type.width; - tmp_type.length = dst_type.length; - num_tmps = num_dsts; + tmp_type = new_type; + num_tmps = num_dsts; + } /* * Scale to the widest range -- cgit v1.2.3