Module: Mesa Branch: main Commit: f5caaf2d750184deee2b991a7f2e2cded9980a94 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f5caaf2d750184deee2b991a7f2e2cded9980a94
Author: Mike Blumenkrantz <[email protected]> Date: Sat Apr 23 11:40:48 2022 -0400 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 <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16137> --- 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 09f6080fca2..da07fa4bc8a 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]); } } }
