Mesa (main): clover: Don't remove sampler/image uniforms

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Sep 5 18:34:35 UTC 2021


Module: Mesa
Branch: main
Commit: 6619877bdfa51a0d199d29770958aebd7cf3e09d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6619877bdfa51a0d199d29770958aebd7cf3e09d

Author: Rob Clark <robdclark at chromium.org>
Date:   Mon Aug 23 17:19:07 2021 -0700

clover: Don't remove sampler/image uniforms

Otherwise we fool nir_shader_gather_info() into telling us there are no
samplers/images.

Signed-off-by: Rob Clark <robdclark at chromium.org>
Reviewed-by: Karol Herbst <kherbst at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12733>

---

 src/gallium/drivers/llvmpipe/ci/llvmpipe-cl.txt |  6 ------
 src/gallium/frontends/clover/nir/invocation.cpp | 11 ++++++++++-
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/ci/llvmpipe-cl.txt b/src/gallium/drivers/llvmpipe/ci/llvmpipe-cl.txt
index dbbcbcde0e1..cbcb4abde89 100644
--- a/src/gallium/drivers/llvmpipe/ci/llvmpipe-cl.txt
+++ b/src/gallium/drivers/llvmpipe/ci/llvmpipe-cl.txt
@@ -73,17 +73,11 @@ program/execute/calls-struct/small struct in regs: fail
 program/execute/fdiv-modifiers-f32: fail
 program/execute/global-offset/3d, input dependent: fail
 program/execute/image-attributes: crash
-program/execute/image-read-2d/read float from cl_float cl_rgba image.: fail
-program/execute/image-read-2d/read signed integer from cl_signed_int8 cl_rgba image.: fail
-program/execute/image-read-2d/read unsigned integer from cl_unsigned_int8 cl_rgba image.: fail
 program/execute/image-write-2d: crash
 program/execute/load-hi16-generic: skip
 program/execute/load-lo16-generic: skip
 program/execute/mad-mix: skip
 program/execute/program-tester-check-local-size-test-should-skip/this test should skip: skip
-program/execute/sampler/read from image using clamp_to_edge addressing mode: fail
-program/execute/sampler/read from image using linear filtering and normalized coords: fail
-program/execute/sampler/read from image using linear filtering and unnormalized coords: fail
 program/execute/scalar-logical-float: skip
 program/execute/store-hi16-generic: skip
 program/execute/vload/vload-half-constant: skip
diff --git a/src/gallium/frontends/clover/nir/invocation.cpp b/src/gallium/frontends/clover/nir/invocation.cpp
index 70d47d964a8..151b37d3046 100644
--- a/src/gallium/frontends/clover/nir/invocation.cpp
+++ b/src/gallium/frontends/clover/nir/invocation.cpp
@@ -396,6 +396,12 @@ nir_shader *clover::nir::load_libclc_nir(const device &dev, std::string &r_log)
 				 &spirv_options, compiler_options);
 }
 
+static bool
+can_remove_var(nir_variable *var, void *data)
+{
+   return !(var->type->is_sampler() || var->type->is_image());
+}
+
 module clover::nir::spirv_to_nir(const module &mod, const device &dev,
                                  std::string &r_log)
 {
@@ -525,7 +531,10 @@ module clover::nir::spirv_to_nir(const module &mod, const device &dev,
       NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_mem_global,
                  spirv_options.global_addr_format);
 
-      NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_all, NULL);
+      struct nir_remove_dead_variables_options remove_dead_variables_options = {
+            .can_remove_var = can_remove_var,
+      };
+      NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_all, &remove_dead_variables_options);
 
       if (compiler_options->lower_int64_options)
          NIR_PASS_V(nir, nir_lower_int64);



More information about the mesa-commit mailing list