nir: fix invalid sampler search by texture id
authorIllia Polishchuk <illia.a.polishchuk@globallogic.com>
Mon, 11 Sep 2023 13:10:57 +0000 (16:10 +0300)
committerMarge Bot <emma+marge@anholt.net>
Tue, 12 Sep 2023 15:44:52 +0000 (15:44 +0000)
Sampler id cannot be mapped to a uniform object location

Fixes: 1a8dd84ec61 ("nir: Propagate the type sampler type change to the used variable.")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9793

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Signed-off-by: Illia Polishchuk <illia.a.polishchuk@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25145>

src/compiler/nir/nir_remove_tex_shadow.c

index 8646821..9e1e1ba 100644 (file)
@@ -85,7 +85,8 @@ remove_tex_shadow(struct nir_builder *b, nir_instr *instr, void *data)
          sampler->type = strip_shadow_with_array(sampler->type);
          sampler_deref->type = sampler->type;
       } else {
-         sampler = nir_find_variable_with_location(b->shader, nir_var_uniform, tex->sampler_index);
+         sampler = nir_find_sampler_variable_with_tex_index(b->shader,
+                                                            tex->texture_index);
          sampler->type = strip_shadow_with_array(sampler->type);
       }