radv: Implement nir_intrinsic_load_layer_id().

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Daniel Schürmann
2019-04-05 10:52:31 +02:00
committed by Connor Abbott
parent c31f470066
commit c65e880a65
3 changed files with 9 additions and 1 deletions

View File

@@ -3200,6 +3200,9 @@ static void visit_intrinsic(struct ac_nir_context *ctx,
ac_build_gather_values(&ctx->ac, values, 4)); ac_build_gather_values(&ctx->ac, values, 4));
break; 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: case nir_intrinsic_load_front_face:
result = ctx->abi->front_face; result = ctx->abi->front_face;
break; break;

View File

@@ -2479,7 +2479,8 @@ handle_fs_inputs(struct radv_shader_context *ctx,
unsigned index = 0; unsigned index = 0;
if (ctx->shader_info->info.ps.uses_input_attachments || 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->input_mask |= 1ull << VARYING_SLOT_LAYER;
ctx->inputs[ac_llvm_reg_index_soa(VARYING_SLOT_LAYER, 0)] = LLVMGetUndef(ctx->ac.i32); ctx->inputs[ac_llvm_reg_index_soa(VARYING_SLOT_LAYER, 0)] = LLVMGetUndef(ctx->ac.i32);
} }

View File

@@ -265,6 +265,10 @@ gather_intrinsic_info(const nir_shader *nir, const nir_intrinsic_instr *instr,
if (nir->info.stage == MESA_SHADER_FRAGMENT) if (nir->info.stage == MESA_SHADER_FRAGMENT)
info->ps.layer_input = true; info->ps.layer_input = true;
break; 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: case nir_intrinsic_load_invocation_id:
info->uses_invocation_id = true; info->uses_invocation_id = true;
break; break;