zink: don't double-deref bindless texture arrays in shaders
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fri, 28 Oct 2022 13:45:42 +0000 (09:45 -0400)
committerMarge Bot <emma+marge@anholt.net>
Fri, 28 Oct 2022 15:38:41 +0000 (15:38 +0000)
these are already dereferenced

Fixes: b2fcb34e976 ("zink: rework sampler emission")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19377>

src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c

index ad3f48a..d57943d 100644 (file)
@@ -3703,7 +3703,7 @@ emit_tex(struct ntv_context *ctx, nir_tex_instr *tex)
 
    unsigned texture_index = tex->texture_index;
    nir_variable *var = bindless_var ? bindless_var : ctx->sampler_var[tex->texture_index];
-   if (!tex_offset || !var) {
+   if (!bindless_var && (!tex_offset || !var)) {
       if (ctx->sampler_var[texture_index]) {
          if (glsl_type_is_array(ctx->sampler_var[texture_index]->type))
             tex_offset = emit_uint_const(ctx, 32, 0);