From 5e47d6fc73a360a9230f1136005399f7d4d475df Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 13 Feb 2021 13:22:33 -0500 Subject: [PATCH] radeonsi: fix the value of uses_bindless_samplers We don't have any nir_variables for uniforms, so this code wasn't doing anything. Also, uniform handles are almost always uniforms. Acked-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_shader_nir.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index 66a1637..239a6b8 100644 --- a/src/gallium/drivers/radeonsi/si_shader_nir.c +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c @@ -31,17 +31,12 @@ #include "si_shader_internal.h" #include "tgsi/tgsi_from_mesa.h" -static const nir_deref_instr *tex_get_texture_deref(nir_tex_instr *instr) +static const nir_src *get_texture_src(nir_tex_instr *instr, nir_tex_src_type type) { for (unsigned i = 0; i < instr->num_srcs; i++) { - switch (instr->src[i].src_type) { - case nir_tex_src_texture_deref: - return nir_src_as_deref(instr->src[i].src); - default: - break; - } + if (instr->src[i].src_type == type) + return &instr->src[i].src; } - return NULL; } @@ -183,13 +178,10 @@ static void scan_instruction(const struct nir_shader *nir, struct si_shader_info { if (instr->type == nir_instr_type_tex) { nir_tex_instr *tex = nir_instr_as_tex(instr); - const nir_deref_instr *deref = tex_get_texture_deref(tex); - nir_variable *var = deref ? nir_deref_instr_get_variable(deref) : NULL; + const nir_src *handle = get_texture_src(tex, nir_tex_src_texture_handle); - if (var) { - if (var->data.mode != nir_var_uniform || var->data.bindless) - info->uses_bindless_samplers = true; - } + if (handle) + info->uses_bindless_samplers = true; } else if (instr->type == nir_instr_type_intrinsic) { nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr); -- 2.7.4