From c65e880a6555e25c382e806d76795ef48515c983 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Sch=C3=BCrmann?= Date: Fri, 5 Apr 2019 10:52:31 +0200 Subject: [PATCH] radv: Implement nir_intrinsic_load_layer_id(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Connor Abbott Reviewed-by: Bas Nieuwenhuizen Reviewed-by: Marek Olšák --- src/amd/common/ac_nir_to_llvm.c | 3 +++ src/amd/vulkan/radv_nir_to_llvm.c | 3 ++- src/amd/vulkan/radv_shader_info.c | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 7cf10c456e2..50db21f2e18 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -3200,6 +3200,9 @@ static void visit_intrinsic(struct ac_nir_context *ctx, ac_build_gather_values(&ctx->ac, values, 4)); break; } + case nir_intrinsic_load_layer_id: + result = ctx->abi->inputs[ac_llvm_reg_index_soa(VARYING_SLOT_LAYER, 0)]; + break; case nir_intrinsic_load_front_face: result = ctx->abi->front_face; break; diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c index fb6b4bef584..4a1684ab1ac 100644 --- a/src/amd/vulkan/radv_nir_to_llvm.c +++ b/src/amd/vulkan/radv_nir_to_llvm.c @@ -2479,7 +2479,8 @@ handle_fs_inputs(struct radv_shader_context *ctx, unsigned index = 0; if (ctx->shader_info->info.ps.uses_input_attachments || - ctx->shader_info->info.needs_multiview_view_index) { + ctx->shader_info->info.needs_multiview_view_index || + ctx->shader_info->info.ps.layer_input) { ctx->input_mask |= 1ull << VARYING_SLOT_LAYER; ctx->inputs[ac_llvm_reg_index_soa(VARYING_SLOT_LAYER, 0)] = LLVMGetUndef(ctx->ac.i32); } diff --git a/src/amd/vulkan/radv_shader_info.c b/src/amd/vulkan/radv_shader_info.c index 5d9f79a8b3b..5dc00a1a060 100644 --- a/src/amd/vulkan/radv_shader_info.c +++ b/src/amd/vulkan/radv_shader_info.c @@ -265,6 +265,10 @@ gather_intrinsic_info(const nir_shader *nir, const nir_intrinsic_instr *instr, if (nir->info.stage == MESA_SHADER_FRAGMENT) info->ps.layer_input = true; break; + case nir_intrinsic_load_layer_id: + if (nir->info.stage == MESA_SHADER_FRAGMENT) + info->ps.layer_input = true; + break; case nir_intrinsic_load_invocation_id: info->uses_invocation_id = true; break; -- 2.30.2