agx: fix spilling inside sample loop

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29179>
This commit is contained in:
Alyssa Rosenzweig 2024-04-19 22:00:50 -04:00 committed by Marge Bot
parent bdd200a202
commit 35d6f4a394
2 changed files with 18 additions and 0 deletions

View file

@ -2947,6 +2947,16 @@ agx_compile_function_nir(nir_shader *nir, nir_function_impl *impl,
agx_builder _b = agx_init_builder(ctx, agx_before_block(start_block));
agx_stack_adjust(&_b, stack_size);
/* If we're going to execute multiple times, make sure we clean up after
* ourselves, else the hardware faults.
*/
if (ctx->stage == MESA_SHADER_FRAGMENT && !ctx->is_preamble &&
ctx->key->fs.inside_sample_loop) {
_b = agx_init_builder(ctx, agx_after_block(agx_end_block(ctx)));
agx_stack_adjust(&_b, -stack_size);
}
if (ctx->is_preamble)
out->preamble_scratch_size = stack_size;
else

View file

@ -584,6 +584,14 @@ agx_start_block(agx_context *ctx)
return first;
}
static inline agx_block *
agx_end_block(agx_context *ctx)
{
agx_block *last = list_last_entry(&ctx->blocks, agx_block, link);
assert(agx_num_successors(last) == 0);
return last;
}
void agx_block_add_successor(agx_block *block, agx_block *successor);
/* Iterators for AGX IR */