Mesa (staging/22.0): gallivm/sample: detect if rho is inf or nan and flush to zero.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 14 22:51:03 UTC 2022


Module: Mesa
Branch: staging/22.0
Commit: a697274e402956f155390e0a4f24bd2ac959e418
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a697274e402956f155390e0a4f24bd2ac959e418

Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Mar 11 12:57:14 2022 +1000

gallivm/sample: detect if rho is inf or nan and flush to zero.

When using cubemaps and the u/v values are 0, then this point
can be arrived at with rho = nan, and if rho is NaN, then lod
calculations end up at the max lod, whereas the spec suggests
they should end up at the most negative lod.

This fixes
dEQP-VK.glsl.texture_functions.query.texturequerylod.samplercube_float_zero_uv_width_fragment

Acked-by: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15335>
(cherry picked from commit 3bbd404457e6e3278afd78f6721be9e174c6b777)

---

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

diff --git a/.pick_status.json b/.pick_status.json
index b0e6faf6e57..b9181e08b98 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -7476,7 +7476,7 @@
         "description": "gallivm/sample: detect if rho is inf or nan and flush to zero.",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 5,
+        "resolution": 1,
         "because_sha": null
     },
     {
@@ -8052,7 +8052,7 @@
         "description": "Revert \"anv: Disable CCS_E for some 8/16bpp copies on TGL+\"",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 5,
+        "resolution": 1,
         "because_sha": "57445adc89186fcadc1e6006d1aa32768b26556b"
     },
     {
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
index 19bd8463d44..f04b692204f 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
@@ -445,6 +445,10 @@ lp_build_rho(struct lp_build_sample_context *bld,
             }
          }
       }
+
+      LLVMValueRef rho_is_inf = lp_build_is_inf_or_nan(gallivm, coord_bld->type, rho);
+      rho = lp_build_select(coord_bld, rho_is_inf, coord_bld->zero, rho);
+
       if (rho_per_quad) {
          /*
           * rho_vec contains per-pixel rho, convert to scalar per quad.



More information about the mesa-commit mailing list