Mesa (master): radv/ac: Fix shared memory offset calculation

Bas Nieuwenhuizen bnieuwenhuizen at kemper.freedesktop.org
Fri Mar 17 08:36:53 UTC 2017


Module: Mesa
Branch: master
Commit: ce4058dafd2dd283addaa99e8d5b51e53f634f9b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ce4058dafd2dd283addaa99e8d5b51e53f634f9b

Author: Alex Smith <asmith at feralinteractive.com>
Date:   Thu Mar 16 16:40:07 2017 +0000

radv/ac: Fix shared memory offset calculation

The index passed to get_shared_memory_ptr is an attribute slot index,
i.e. the index of a vec4 within LDS. Therefore this must be scaled by
sizeof(vec4) to give the LDS byte offset.

Fixes: f4e499ec791 ("radv: add initial non-conformant radv vulkan driver")
Signed-off-by: Alex Smith <asmith at feralinteractive.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
CC: <mesa-stable at lists.freedesktop.org>

---

 src/amd/common/ac_nir_to_llvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 01346c35f7..6e36c192c3 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -297,7 +297,7 @@ static LLVMValueRef get_shared_memory_ptr(struct nir_to_llvm_context *ctx,
 	LLVMValueRef ptr;
 	int addr_space;
 
-	offset = LLVMConstInt(ctx->i32, idx, false);
+	offset = LLVMConstInt(ctx->i32, idx * 16, false);
 
 	ptr = ctx->shared_memory;
 	ptr = LLVMBuildGEP(ctx->builder, ptr, &offset, 1, "");




More information about the mesa-commit mailing list