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@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6496>
This commit is contained in:
Eric Anholt 2020-08-28 12:27:04 -07:00 committed by Marge Bot
parent a3a8322dcd
commit e281ee04df

View file

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