From: Daniel Schürmann Date: Fri, 5 Apr 2019 08:52:31 +0000 (+0200) Subject: radv: Implement nir_intrinsic_load_layer_id(). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c65e880a6555e25c382e806d76795ef48515c983;p=mesa.git radv: Implement nir_intrinsic_load_layer_id(). Reviewed-by: Connor Abbott Reviewed-by: Bas Nieuwenhuizen Reviewed-by: Marek Olšák --- 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;