nir/print: compact printing of intrinsic indices

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14222>
This commit is contained in:
Marcin Ślusarz 2021-10-19 11:27:40 +02:00 committed by Marge Bot
parent d8fa625bb3
commit f7e63ec5d8
1 changed files with 21 additions and 25 deletions

View File

@ -830,17 +830,10 @@ print_intrinsic_instr(nir_intrinsic_instr *instr, print_state *state)
fprintf(fp, ") (");
for (unsigned i = 0; i < info->num_indices; i++) {
unsigned idx = info->indices[i];
bool print_raw = true;
if (i != 0)
fprintf(fp, ", ");
fprintf(fp, "%d", instr->const_index[i]);
}
fprintf(fp, ")");
for (unsigned i = 0; i < info->num_indices; i++) {
unsigned idx = info->indices[i];
fprintf(fp, " /*");
switch (idx) {
case NIR_INTRINSIC_WRITE_MASK: {
/* special case wrmask to show it as a writemask.. */
@ -1016,11 +1009,14 @@ print_intrinsic_instr(nir_intrinsic_instr *instr, print_state *state)
default: {
unsigned off = info->index_map[idx] - 1;
fprintf(fp, "%s=%d", nir_intrinsic_index_names[idx], instr->const_index[off]);
print_raw = false;
break;
}
}
fprintf(fp, " */");
if (print_raw)
fprintf(fp, " /*%d*/", instr->const_index[i]);
}
fprintf(fp, ")");
if (!state->shader)
return;