diff options
author | Marek Olšák <[email protected]> | 2020-02-26 22:48:41 -0500 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2020-03-09 16:08:14 -0400 |
commit | c1b8e84961066a25e0950e7965285b47df4bb97f (patch) | |
tree | 793d6a0606417baad66f2be556d64173c4e04e2c /src/gallium | |
parent | fc65df56519af568c2e5954793c17a8aed858148 (diff) |
radeonsi: determine uses_bindless_samplers correctly
Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4079>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4079>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader_nir.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index da97b738c40..49393af3abd 100644 --- a/src/gallium/drivers/radeonsi/si_shader_nir.c +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c @@ -34,12 +34,12 @@ #include "compiler/nir/nir_builder.h" #include "compiler/nir/nir_deref.h" -static nir_variable* tex_get_texture_var(nir_tex_instr *instr) +static const nir_deref_instr *tex_get_texture_deref(nir_tex_instr *instr) { for (unsigned i = 0; i < instr->num_srcs; i++) { switch (instr->src[i].src_type) { case nir_tex_src_texture_deref: - return nir_deref_instr_get_variable(nir_src_as_deref(instr->src[i].src)); + return nir_src_as_deref(instr->src[i].src); default: break; } @@ -201,13 +201,14 @@ static void scan_instruction(const struct nir_shader *nir, } } else if (instr->type == nir_instr_type_tex) { nir_tex_instr *tex = nir_instr_as_tex(instr); - nir_variable *texture = tex_get_texture_var(tex); + const nir_deref_instr *deref = tex_get_texture_deref(tex); + nir_variable *var = deref ? nir_deref_instr_get_variable(deref) : NULL; - if (!texture) { + if (!var) { info->samplers_declared |= u_bit_consecutive(tex->sampler_index, 1); } else { - if (texture->data.bindless) + if (deref->mode != nir_var_uniform || var->data.bindless) info->uses_bindless_samplers = true; } |