agx: Terminate programs with stop and traps

The function of stop is clear. The function of trap, let alone a whole
sled of them, is less so. Maybe a debugging feature for later.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>
This commit is contained in:
Alyssa Rosenzweig
2021-04-11 23:00:35 -04:00
committed by Alyssa Rosenzweig
parent 5b34cc40ca
commit e54fdc0fac

View File

@@ -494,6 +494,15 @@ agx_compile_shader_nir(nir_shader *nir,
break; /* TODO: Multi-function shaders */ break; /* TODO: Multi-function shaders */
} }
/* Terminate the shader after the exit block */
agx_block *last_block = list_last_entry(&ctx->blocks, agx_block, link);
agx_builder _b = agx_init_builder(ctx, agx_after_block(last_block));
agx_stop(&_b);
/* Also add traps to match the blob, unsure what the function is */
for (unsigned i = 0; i < 8; ++i)
agx_trap(&_b);
unsigned block_source_count = 0; unsigned block_source_count = 0;
/* Name blocks now that we're done emitting so the order is consistent */ /* Name blocks now that we're done emitting so the order is consistent */