Mesa (master): gallivm: fix rgtc2 format

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 2 16:15:45 UTC 2020


Module: Mesa
Branch: master
Commit: ebb5b88a02637908b9f4bfd0644964d6347b23af
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ebb5b88a02637908b9f4bfd0644964d6347b23af

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Thu Apr  2 02:51:03 2020 +0200

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 <airlied at redhat.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4416>

---

 src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c | 2 ++
 1 file changed, 2 insertions(+)

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;
 }



More information about the mesa-commit mailing list