broadcom/compiler: handle vec2 load/store index

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 <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19313>
This commit is contained in:
Iago Toral Quiroga 2022-10-26 09:01:59 +02:00
parent 2ab70c1004
commit 8cd50ef071

View file

@ -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