From 8cd50ef0713b054da3b5615c81939d4c649a44ac Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Wed, 26 Oct 2022 09:01:59 +0200 Subject: [PATCH] broadcom/compiler: handle vec2 load/store index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In vulkan, we load descriptors via vulkan resource index, which returns a vec2, of which we want component 0 which holds the actual index. Typically, this will be cleaned-up by the time we get to emitting VIR so the index is a single scalar component, but there are some cases where this might no be the case, so make sure we don't assume it to be a scalar, like we do in other places. Reviewed-by: Alejandro PiƱeiro Part-of: --- src/broadcom/compiler/nir_to_vir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c index 5d26d49382b..64c3eb12aec 100644 --- a/src/broadcom/compiler/nir_to_vir.c +++ b/src/broadcom/compiler/nir_to_vir.c @@ -595,9 +595,9 @@ ntq_emit_tmu_general(struct v3d_compile *c, nir_intrinsic_instr *instr, */ base_offset = vir_uniform_ui(c, 0); } else { + uint32_t idx = is_store ? 1 : 0; base_offset = vir_uniform(c, QUNIFORM_SSBO_OFFSET, - nir_src_as_uint(instr->src[is_store ? - 1 : 0])); + nir_src_comp_as_uint(instr->src[idx], 0)); } /* We are ready to emit TMU register writes now, but before we actually