mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 11:00:11 +01:00
ac/nir: use shader_info pass to determine whether instance_id is used
This improves the separation of ABI and NIR translation. Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
parent
be0488a173
commit
ba06e8bbe8
3 changed files with 9 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue