radv: Implement nir_intrinsic_load_layer_id().
authorDaniel Schürmann <daniel.schuermann@campus.tu-berlin.de>
Fri, 5 Apr 2019 08:52:31 +0000 (10:52 +0200)
committerConnor Abbott <cwabbott0@gmail.com>
Mon, 8 Jul 2019 12:14:53 +0000 (14:14 +0200)
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/amd/common/ac_nir_to_llvm.c
src/amd/vulkan/radv_nir_to_llvm.c
src/amd/vulkan/radv_shader_info.c

index 7cf10c456e2397b8ab29c237bb607c31fa1e7909..50db21f2e18dc5971d4d0453872776e4a6a318d5 100644 (file)
@@ -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;
index fb6b4bef584a7349364f11d90eae884157e338ad..4a1684ab1ac8a0c5702e7a18733bdb3dd532ab32 100644 (file)
@@ -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);
        }
index 5d9f79a8b3b6b5e68c52648bf8855dc83ffaef69..5dc00a1a0607f338a946b2cd84094b9881692fe1 100644 (file)
@@ -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;