nir: Fix printing of individual instructions with io semantics.

The state->shader is missing when used outside of nir_print_shader, just
drop these details in that case.  We can fix nir_print_instr() to look up
the shader, but let's also make sure that an instr detached from a shader
(such as one you're constructing but haven't yet inserted) still works.

Fixes: 2b1ef5df4e ("nir: print IO semantics (v2)")
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-27 11:33:31 -07:00 committed by Marge Bot
parent 4c050f222f
commit a3a8322dcd
1 changed files with 20 additions and 18 deletions

View File

@ -929,6 +929,7 @@ print_intrinsic_instr(nir_intrinsic_instr *instr, print_state *state)
fprintf(fp, " location=%u slots=%u",
nir_intrinsic_io_semantics(instr).location,
nir_intrinsic_io_semantics(instr).num_slots);
if (state->shader) {
if (state->shader->info.stage == MESA_SHADER_FRAGMENT &&
instr->intrinsic == nir_intrinsic_store_output &&
nir_intrinsic_io_semantics(instr).dual_source_blend_index) {
@ -949,6 +950,7 @@ print_intrinsic_instr(nir_intrinsic_instr *instr, print_state *state)
}
fprintf(fp, ")");
}
}
break;
default: {