diff options
author | Dave Airlie <[email protected]> | 2017-02-03 03:26:13 +0000 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2017-02-10 11:05:58 +0000 |
commit | 241e0b7068c0ae8e5e3480b9f6846a5749184626 (patch) | |
tree | 4ae9e17eb365a02fb6462ccd5a21c11f99cafdda /src/amd | |
parent | e789af4a9f10e56f908e3c55c6d764d62c7838de (diff) |
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 <[email protected]>
Cc: "17.0" <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
(cherry picked from commit 106a51440d018031b94c91758eecc7424a3bb5ee)
[Emil Velikov: resolve trivial conflicts]
Signed-off-by: Emil Velikov <[email protected]>
Conflicts:
src/amd/common/ac_nir_to_llvm.c
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 68c385a9708..319bb3ecadd 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -2086,6 +2086,9 @@ static LLVMValueRef visit_load_var(struct nir_to_llvm_context *ctx, LLVMValueRef ptr = get_shared_memory_ptr(ctx, idx, ctx->i32); 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++) { LLVMValueRef index = LLVMConstInt(ctx->i32, chan, false); if (indir_index) @@ -2190,6 +2193,9 @@ visit_store_var(struct nir_to_llvm_context *ctx, ptr = get_shared_memory_ptr(ctx, idx, ctx->i32); LLVMValueRef derived_ptr; + if (indir_index) + indir_index = LLVMBuildMul(ctx->builder, indir_index, LLVMConstInt(ctx->i32, 4, false), ""); + for (unsigned chan = 0; chan < 4; chan++) { if (!(writemask & (1 << chan))) continue; |