gallivm: switch the mask6/mask7 cases for signed rgtc formats
authorRoland Scheidegger <sroland@vmware.com>
Thu, 2 Apr 2020 02:19:51 +0000 (04:19 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 2 Apr 2020 15:53:23 +0000 (15:53 +0000)
This fixes some regressions where -1.0/1.0 results got flipped, but it's still
broken in some cases.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4416>

src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c

index 50addad486a61d7300cb33f99d7103d66465a97e..d799a5d45a93d117cd2289d64cdbc645e7775b3e 100644 (file)
@@ -1017,8 +1017,8 @@ s3tc_dxt5_alpha_channel(struct gallivm_state *gallivm,
    mask7 = lp_build_compare(gallivm, type, PIPE_FUNC_EQUAL,
                             code_s, lp_build_const_int_vec(gallivm, type, 7));
    if (is_signed) {
-      alpha = lp_build_select(&bld32, mask6, lp_build_const_int_vec(gallivm, type, 127), alpha);
-      alpha = lp_build_select(&bld32, mask7, lp_build_const_int_vec(gallivm, type, -127), alpha);
+      alpha = lp_build_select(&bld32, mask6, lp_build_const_int_vec(gallivm, type, -127), alpha);
+      alpha = lp_build_select(&bld32, mask7, lp_build_const_int_vec(gallivm, type, 127), alpha);
    } else {
       alpha = LLVMBuildAnd(builder, alpha, LLVMBuildNot(builder, mask6, ""), "");
       alpha = LLVMBuildOr(builder, alpha, mask7, "");