ir3: Detect empty fragment shaders

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33735>
This commit is contained in:
Danylo Piliaiev 2025-02-25 13:40:37 +01:00
parent 3d76f307b6
commit b0a98d3b13
2 changed files with 17 additions and 0 deletions

View file

@ -5483,6 +5483,17 @@ fixup_tg4(struct ir3_context *ctx)
}
}
static bool
is_empty(struct ir3 *ir)
{
foreach_block (block, &ir->block_list) {
foreach_instr (instr, &block->instr_list) {
return instr->opc == OPC_END;
}
}
return true;
}
static void
collect_tex_prefetches(struct ir3_context *ctx, struct ir3 *ir)
{
@ -6030,6 +6041,10 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler,
so->constlen = MAX2(so->constlen, 8);
}
if (so->type == MESA_SHADER_FRAGMENT) {
so->empty = is_empty(ir) && so->num_sampler_prefetch == 0;
}
if (gl_shader_stage_is_compute(so->type)) {
so->cs.local_invocation_id =
ir3_find_sysval_regid(so, SYSTEM_VALUE_LOCAL_INVOCATION_ID);

View file

@ -853,6 +853,8 @@ struct ir3_shader_variant {
bool post_depth_coverage;
bool empty;
/* Are we using split or merged register file? */
bool mergedregs;