From f5caaf2d750184deee2b991a7f2e2cded9980a94 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Sat, 23 Apr 2022 11:40:48 -0400 Subject: [PATCH] gallivm: fix oob txf swizzling this wasn't taking into account the format swizzle, returning broken alpha values in most cases Fixes: 0b6554ba6f2 ("gallivm,llvmpipe: handle TXF (texelFetch) instruction, including offsets") Reviewed-by: Dave Airlie Part-of: --- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 09f6080f..da07fa4 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -3201,9 +3201,16 @@ lp_build_fetch_texel(struct lp_build_sample_context *bld, * Could use min/max above instead of out-of-bounds comparisons * if we don't care about the result returned for out-of-bounds. */ + LLVMValueRef oob[4] = { + bld->texel_bld.zero, + bld->texel_bld.zero, + bld->texel_bld.zero, + bld->texel_bld.zero, + }; + lp_build_format_swizzle_soa(bld->format_desc, &bld->texel_bld, oob, oob); for (chan = 0; chan < 4; chan++) { colors_out[chan] = lp_build_select(&bld->texel_bld, out_of_bounds, - bld->texel_bld.zero, colors_out[chan]); + oob[chan], colors_out[chan]); } } } -- 2.7.4