gallivm: fix oob txf swizzling

this wasn't taking into account the format swizzle, returning broken
alpha values in most cases

Fixes: 0b6554ba6f ("gallivm,llvmpipe: handle TXF (texelFetch) instruction, including offsets")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16137>
This commit is contained in:
Mike Blumenkrantz 2022-04-23 11:40:48 -04:00 committed by Marge Bot
parent 8c8d08a8b8
commit f5caaf2d75
1 changed files with 8 additions and 1 deletions

View File

@ -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]);
}
}
}