summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/amd/common/ac_nir_to_llvm.c7
-rw-r--r--src/amd/common/ac_shader_info.c3
-rw-r--r--src/amd/common/ac_shader_info.h1
3 files changed, 9 insertions, 2 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index ec8006889d0..a57fb2fc6b9 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -4023,8 +4023,6 @@ static void visit_intrinsic(struct ac_nir_context *ctx,
break;
case nir_intrinsic_load_instance_id:
result = ctx->abi->instance_id;
- ctx->nctx->shader_info->vs.vgpr_comp_cnt = MAX2(3,
- ctx->nctx->shader_info->vs.vgpr_comp_cnt);
break;
case nir_intrinsic_load_num_work_groups:
result = ctx->nctx->num_work_groups;
@@ -6229,6 +6227,11 @@ LLVMModuleRef ac_translate_nir_to_llvm(LLVMTargetMachineRef tm,
ctx.gs_max_out_vertices = nir->info.gs.vertices_out;
} else if (nir->stage == MESA_SHADER_TESS_EVAL) {
ctx.tes_primitive_mode = nir->info.tess.primitive_mode;
+ } else if (nir->stage == MESA_SHADER_VERTEX) {
+ if (shader_info->info.vs.needs_instance_id) {
+ ctx.shader_info->vs.vgpr_comp_cnt =
+ MAX2(3, ctx.shader_info->vs.vgpr_comp_cnt);
+ }
}
ac_setup_rings(&ctx);
diff --git a/src/amd/common/ac_shader_info.c b/src/amd/common/ac_shader_info.c
index 13d73df11f9..7d34535c107 100644
--- a/src/amd/common/ac_shader_info.c
+++ b/src/amd/common/ac_shader_info.c
@@ -39,6 +39,9 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, struct ac_shader_info *info)
case nir_intrinsic_load_draw_id:
info->vs.needs_draw_id = true;
break;
+ case nir_intrinsic_load_instance_id:
+ info->vs.needs_instance_id = true;
+ break;
case nir_intrinsic_load_num_work_groups:
info->cs.grid_components_used = instr->num_components;
break;
diff --git a/src/amd/common/ac_shader_info.h b/src/amd/common/ac_shader_info.h
index 5f03e79a83d..5bc16cc9d02 100644
--- a/src/amd/common/ac_shader_info.h
+++ b/src/amd/common/ac_shader_info.h
@@ -33,6 +33,7 @@ struct ac_shader_info {
struct {
bool has_vertex_buffers; /* needs vertex buffers and base/start */
bool needs_draw_id;
+ bool needs_instance_id;
} vs;
struct {
bool needs_sample_positions;