From: Roland Scheidegger Date: Thu, 2 Apr 2020 00:51:03 +0000 (+0200) Subject: gallivm: fix rgtc2 format X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;ds=sidebyside;h=ebb5b88a02637908b9f4bfd0644964d6347b23af;p=mesa.git gallivm: fix rgtc2 format In some cases, there can be garbage in the upper bits after the channel decode - for dxt5 this didn't matter (as the upper bits are shifted out anyway) but for rgtc2 formats it does. Reviewed-by: Dave Airlie Reviewed-by: Brian Paul Part-of: --- diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c b/src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c index c5ecaf6ff9a..50addad486a 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c @@ -1023,6 +1023,8 @@ s3tc_dxt5_alpha_channel(struct gallivm_state *gallivm, alpha = LLVMBuildAnd(builder, alpha, LLVMBuildNot(builder, mask6, ""), ""); alpha = LLVMBuildOr(builder, alpha, mask7, ""); } + /* There can be garbage in upper bits, mask them off for rgtc formats */ + alpha = LLVMBuildAnd(builder, alpha, lp_build_const_int_vec(gallivm, type, 0xff), ""); return alpha; }