From e54fdc0fac3170a64cc96b04b401ca57a6f80db1 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 11 Apr 2021 23:00:35 -0400 Subject: [PATCH] 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 Acked-by: Jason Ekstrand Acked-by: Bas Nieuwenhuizen Part-of: --- src/asahi/compiler/agx_compile.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 824b3de2c7a..42fea123232 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -494,6 +494,15 @@ agx_compile_shader_nir(nir_shader *nir, 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; /* Name blocks now that we're done emitting so the order is consistent */