ac/llvm: Make shared loads/stores work correctly for non-CS stages.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9201>
This commit is contained in:
Timur Kristóf
2021-02-19 17:30:08 +01:00
committed by Marge Bot
parent 6e7b1cd251
commit 252b5d5ecd
+5 -1
View File
@@ -83,7 +83,11 @@ static LLVMValueRef get_src(struct ac_nir_context *nir, nir_src src)
static LLVMValueRef get_memory_ptr(struct ac_nir_context *ctx, nir_src src, unsigned bit_size)
{
LLVMValueRef ptr = get_src(ctx, src);
ptr = LLVMBuildGEP(ctx->ac.builder, ctx->ac.lds, &ptr, 1, "");
LLVMValueRef lds_i8 = ctx->ac.lds;
if (ctx->stage != MESA_SHADER_COMPUTE)
lds_i8 = LLVMBuildBitCast(ctx->ac.builder, ctx->ac.lds, LLVMPointerType(ctx->ac.i8, AC_ADDR_SPACE_LDS), "");
ptr = LLVMBuildGEP(ctx->ac.builder, lds_i8, &ptr, 1, "");
int addr_space = LLVMGetPointerAddressSpace(LLVMTypeOf(ptr));
LLVMTypeRef type = LLVMIntTypeInContext(ctx->ac.context, bit_size);