From e281ee04dfe3d035f0da4ad37240392ddf41220c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 28 Aug 2020 12:27:04 -0700 Subject: [PATCH] nir: Look up the shader when printing a single instruction. If you've inserted the instruction into a block, then we can get to the shader. This improves our instruction output, giving you i/o semantics and variable names in intrinsics. Reviewed-by: Jason Ekstrand Part-of: --- src/compiler/nir/nir_print.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index 6e871b6c950..c5a8efd1ec5 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -1586,6 +1586,11 @@ nir_print_instr(const nir_instr *instr, FILE *fp) print_state state = { .fp = fp, }; + if (instr->block) { + nir_function_impl *impl = nir_cf_node_get_function(&instr->block->cf_node); + state.shader = impl->function->shader; + } + print_instr(instr, &state, 0); } -- 2.30.2