Mesa (staging/22.1): gallivm: fix oob txf swizzling

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed May 11 04:23:24 UTC 2022


Module: Mesa
Branch: staging/22.1
Commit: 0b90d3dc580c5c74cd0c318f8111c1703dadb862
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0b90d3dc580c5c74cd0c318f8111c1703dadb862

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
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 <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16137>
(cherry picked from commit f5caaf2d750184deee2b991a7f2e2cded9980a94)

---

 .pick_status.json                                 | 2 +-
 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index c2ca907545c..565fc73b4ca 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -337,7 +337,7 @@
         "description": "gallivm: fix oob txf swizzling",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "0b6554ba6f2aa8a771852566340c24205e406d02"
     },
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 8417cdd79fc..004da18867c 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -3200,9 +3200,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]);
       }
    }
 }



More information about the mesa-commit mailing list