diff options
author | Bas Nieuwenhuizen <[email protected]> | 2017-01-28 01:32:20 +0100 |
---|---|---|
committer | Bas Nieuwenhuizen <[email protected]> | 2017-01-28 03:07:39 +0100 |
commit | 96c60b7f07e626d9ca0fc5789117f0c725ba1da2 (patch) | |
tree | 0b09dbd40337f39237dfe65840b7bb10b0ecb033 | |
parent | e8047980d2814198988e9124036f702c4518df8b (diff) |
radv/ac: Use base in push constant loads.
Apparently the source is not an address but an offset, so we actually
need to use the base.
Signed-off-by: Bas Nieuwenhuizen <[email protected]>
Reviewed-by: Dave Airlie <[email protected]>
CC: <[email protected]>
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 26b87e8782b..72ae6eb0730 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -1745,9 +1745,12 @@ static LLVMValueRef visit_vulkan_resource_index(struct nir_to_llvm_context *ctx, static LLVMValueRef visit_load_push_constant(struct nir_to_llvm_context *ctx, nir_intrinsic_instr *instr) { - LLVMValueRef ptr; + LLVMValueRef ptr, addr; + + addr = LLVMConstInt(ctx->i32, nir_intrinsic_base(instr), 0); + addr = LLVMBuildAdd(ctx->builder, addr, get_src(ctx, instr->src[0]), ""); - ptr = build_gep0(ctx, ctx->push_constants, get_src(ctx, instr->src[0])); + ptr = build_gep0(ctx, ctx->push_constants, addr); ptr = cast_ptr(ctx, ptr, get_def_type(ctx, &instr->dest.ssa)); return LLVMBuildLoad(ctx->builder, ptr, ""); |