nir/gl_nir_lower_samplers_as_deref: Support nir_var_mem_image

Contrary to the name of the pass, it also handles storage images so we
need to support nir_var_mem_image.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4743>
This commit is contained in:
Jason Ekstrand
2021-09-15 16:57:19 -05:00
committed by Marge Bot
parent c0d8dc13e0
commit 7bdae87b93

View File

@@ -141,7 +141,8 @@ lower_deref(nir_builder *b, struct lower_samplers_as_deref_state *state,
nir_variable *var = nir_deref_instr_get_variable(deref);
gl_shader_stage stage = state->shader->info.stage;
if (var->data.bindless || var->data.mode != nir_var_uniform)
if (!(var->data.mode & (nir_var_uniform | nir_var_mem_image)) ||
var->data.bindless)
return NULL;
nir_deref_path path;
@@ -191,7 +192,7 @@ lower_deref(nir_builder *b, struct lower_samplers_as_deref_state *state,
if (h) {
var = (nir_variable *)h->data;
} else {
var = nir_variable_create(state->shader, nir_var_uniform, type, name);
var = nir_variable_create(state->shader, var->data.mode, type, name);
var->data.binding = binding;
/* Don't set var->data.location. The old structure location could be