Mesa (master): nir: Look up the shader when printing a single instruction.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Aug 31 17:35:26 UTC 2020


Module: Mesa
Branch: master
Commit: e281ee04dfe3d035f0da4ad37240392ddf41220c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e281ee04dfe3d035f0da4ad37240392ddf41220c

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Aug 28 12:27:04 2020 -0700

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 <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6496>

---

 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);
 
 }



More information about the mesa-commit mailing list