gallivm: Fix the type of array nir_registers.

This now matches how they get dereffed by get_soa_array_offsets() -- each
array element has num_components vecs inside of it, rather than each
components has an array in it.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21084>
This commit is contained in:
Emma Anholt 2023-02-02 14:04:56 -08:00 committed by Marge Bot
parent a5d360550e
commit 833a74351c
2 changed files with 3 additions and 3 deletions

View file

@ -2711,10 +2711,10 @@ get_register_type(struct lp_build_nir_context *bld_base,
get_int_bld(bld_base, true, reg->bit_size == 1 ? 32 : reg->bit_size);
LLVMTypeRef type = int_bld->vec_type;
if (reg->num_array_elems)
type = LLVMArrayType(type, reg->num_array_elems);
if (reg->num_components > 1)
type = LLVMArrayType(type, reg->num_components);
if (reg->num_array_elems)
type = LLVMArrayType(type, reg->num_array_elems);
return type;
}

View file

@ -227,7 +227,7 @@ get_soa_array_offsets(struct lp_build_context *uint_bld,
lp_build_const_int_vec(gallivm, uint_bld->type, uint_bld->type.length);
LLVMValueRef index_vec;
/* index_vec = (indirect_index * 4 + chan_index) * length + offsets */
/* index_vec = (indirect_index * num_components + chan_index) * length + offsets */
index_vec = lp_build_mul(uint_bld, indirect_index, lp_build_const_int_vec(uint_bld->gallivm, uint_bld->type, num_components));
index_vec = lp_build_add(uint_bld, index_vec, chan_vec);
index_vec = lp_build_mul(uint_bld, index_vec, length_vec);