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@chromium.org>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12733>
This commit is contained in:
Rob Clark 2021-08-23 17:19:07 -07:00 committed by Marge Bot
parent 43c4f5eb63
commit 6619877bdf
2 changed files with 10 additions and 7 deletions

View File

@ -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

View File

@ -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);