diff options
author | Samuel Pitoiset <[email protected]> | 2018-02-09 13:54:23 +0100 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2018-02-12 11:54:13 +0100 |
commit | ed179fbdf37192cba5f3ff1c335d8ac09323ea81 (patch) | |
tree | 9b5fa355d1275685d5957db0e45d2ae1efb628f0 /src/amd/common | |
parent | ecf229706ff666332b253b09f5b0808b5cd5f591 (diff) |
ac: add load_resource() to the ABI
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/common')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 20 | ||||
-rw-r--r-- | src/amd/common/ac_shader_abi.h | 12 |
2 files changed, 25 insertions, 7 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 406f55d8c40..f99c9d3d692 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -2351,12 +2351,11 @@ static LLVMValueRef build_tex_intrinsic(struct ac_nir_context *ctx, return ac_build_image_opcode(&ctx->ac, args); } -static LLVMValueRef visit_vulkan_resource_index(struct nir_to_llvm_context *ctx, - nir_intrinsic_instr *instr) +static LLVMValueRef +radv_load_resource(struct ac_shader_abi *abi, LLVMValueRef index, + unsigned desc_set, unsigned binding) { - LLVMValueRef index = get_src(ctx->nir, instr->src[0]); - unsigned desc_set = nir_intrinsic_desc_set(instr); - unsigned binding = nir_intrinsic_binding(instr); + struct nir_to_llvm_context *ctx = nir_to_llvm_context_from_abi(abi); LLVMValueRef desc_ptr = ctx->descriptor_sets[desc_set]; struct radv_pipeline_layout *pipeline_layout = ctx->options->layout; struct radv_descriptor_set_layout *layout = pipeline_layout->set[desc_set].layout; @@ -4386,9 +4385,15 @@ static void visit_intrinsic(struct ac_nir_context *ctx, case nir_intrinsic_load_push_constant: result = visit_load_push_constant(ctx->nctx, instr); break; - case nir_intrinsic_vulkan_resource_index: - result = visit_vulkan_resource_index(ctx->nctx, instr); + case nir_intrinsic_vulkan_resource_index: { + LLVMValueRef index = get_src(ctx, instr->src[0]); + unsigned desc_set = nir_intrinsic_desc_set(instr); + unsigned binding = nir_intrinsic_binding(instr); + + result = ctx->abi->load_resource(ctx->abi, index, desc_set, + binding); break; + } case nir_intrinsic_vulkan_resource_reindex: result = visit_vulkan_resource_reindex(ctx->nctx, instr); break; @@ -6781,6 +6786,7 @@ LLVMModuleRef ac_translate_nir_to_llvm(LLVMTargetMachineRef tm, ctx.abi.load_ubo = radv_load_ubo; ctx.abi.load_ssbo = radv_load_ssbo; ctx.abi.load_sampler_desc = radv_get_sampler_desc; + ctx.abi.load_resource = radv_load_resource; ctx.abi.clamp_shadow_reference = false; if (shader_count >= 2) diff --git a/src/amd/common/ac_shader_abi.h b/src/amd/common/ac_shader_abi.h index c5f7fcd2f87..c89987c35f8 100644 --- a/src/amd/common/ac_shader_abi.h +++ b/src/amd/common/ac_shader_abi.h @@ -156,6 +156,18 @@ struct ac_shader_abi { enum ac_descriptor_type desc_type, bool image, bool write); + /** + * Load a Vulkan-specific resource. + * + * \param index resource index + * \param desc_set descriptor set + * \param binding descriptor set binding + */ + LLVMValueRef (*load_resource)(struct ac_shader_abi *abi, + LLVMValueRef index, + unsigned desc_set, + unsigned binding); + LLVMValueRef (*lookup_interp_param)(struct ac_shader_abi *abi, enum glsl_interp_mode interp, unsigned location); |