Mesa (staging/22.0): nir/fold_16bit_sampler_conversions: Fix dest type mismatches.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 1 16:17:36 UTC 2022


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

Author: Georg Lehmann <dadschoorse at gmail.com>
Date:   Sat Feb  5 23:03:32 2022 +0100

nir/fold_16bit_sampler_conversions: Fix dest type mismatches.

Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5996
Fixes: fb29cef8dda ("nir: add many passes that lower and optimize 16-bit input/outputs and samplers")
Signed-off-by: Georg Lehmann <dadschoorse at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14895>
(cherry picked from commit 88ec73e5e8384a7671838518c987889ffb02ad3e)

---

 .pick_status.json                    | 2 +-
 src/compiler/nir/nir_lower_mediump.c | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 6a892fd975f..f6cbb61b1f9 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1988,7 +1988,7 @@
         "description": "nir/fold_16bit_sampler_conversions: Fix dest type mismatches.",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 5,
+        "resolution": 1,
         "because_sha": "fb29cef8ddabdd05aeddc5220017bb28a83bb19c"
     },
     {
diff --git a/src/compiler/nir/nir_lower_mediump.c b/src/compiler/nir/nir_lower_mediump.c
index b9710271fda..5bbbe20b5c4 100644
--- a/src/compiler/nir/nir_lower_mediump.c
+++ b/src/compiler/nir/nir_lower_mediump.c
@@ -514,8 +514,9 @@ nir_fold_16bit_sampler_conversions(nir_shader *nir,
          }
 
          /* Optimize the destination. */
-         bool is_f32_to_f16 = true;
-         bool is_i32_to_i16 = true; /* same behavior for int and uint */
+         bool is_f32_to_f16 = tex->dest_type & nir_type_float;
+         /* same behavior for int and uint */
+         bool is_i32_to_i16 = tex->dest_type & (nir_type_int | nir_type_uint);
 
          nir_foreach_use(use, &tex->dest.ssa) {
             is_f32_to_f16 &= is_f32_to_f16_conversion(use->parent_instr);



More information about the mesa-commit mailing list