radv: fix shared memory load/stores.
If we have an indirect index here we need to scale it by attribute slots e.g. is this is vec2[256] then we get an indir_index in the 0.255 range but the vec2 are aligned inside vec4 slots. So scale the indir index, then extract the channels. Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Cc: "17.0" <mesa-stable@lists.freedesktop.org> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
a1a8aef4c9
commit
106a51440d
|
@ -2237,6 +2237,9 @@ static LLVMValueRef visit_load_var(struct nir_to_llvm_context *ctx,
|
||||||
LLVMValueRef ptr = get_shared_memory_ptr(ctx, idx, ctx->i32);
|
LLVMValueRef ptr = get_shared_memory_ptr(ctx, idx, ctx->i32);
|
||||||
LLVMValueRef derived_ptr;
|
LLVMValueRef derived_ptr;
|
||||||
|
|
||||||
|
if (indir_index)
|
||||||
|
indir_index = LLVMBuildMul(ctx->builder, indir_index, LLVMConstInt(ctx->i32, 4, false), "");
|
||||||
|
|
||||||
for (unsigned chan = 0; chan < ve; chan++) {
|
for (unsigned chan = 0; chan < ve; chan++) {
|
||||||
LLVMValueRef index = LLVMConstInt(ctx->i32, chan, false);
|
LLVMValueRef index = LLVMConstInt(ctx->i32, chan, false);
|
||||||
if (indir_index)
|
if (indir_index)
|
||||||
|
@ -2343,6 +2346,10 @@ visit_store_var(struct nir_to_llvm_context *ctx,
|
||||||
break;
|
break;
|
||||||
case nir_var_shared: {
|
case nir_var_shared: {
|
||||||
LLVMValueRef ptr = get_shared_memory_ptr(ctx, idx, ctx->i32);
|
LLVMValueRef ptr = get_shared_memory_ptr(ctx, idx, ctx->i32);
|
||||||
|
|
||||||
|
if (indir_index)
|
||||||
|
indir_index = LLVMBuildMul(ctx->builder, indir_index, LLVMConstInt(ctx->i32, 4, false), "");
|
||||||
|
|
||||||
for (unsigned chan = 0; chan < 8; chan++) {
|
for (unsigned chan = 0; chan < 8; chan++) {
|
||||||
if (!(writemask & (1 << chan)))
|
if (!(writemask & (1 << chan)))
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue