nir: print i/o variables in location order

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25036>
This commit is contained in:
Mike Blumenkrantz 2023-09-01 10:24:50 -04:00 committed by Marge Bot
parent cdcb2ab538
commit 6ae2147dd6

View file

@ -2620,10 +2620,26 @@ nir_print_shader_annotated(nir_shader *shader, FILE *fp,
if (shader->constant_data_size)
fprintf(fp, "constants: %u\n", shader->constant_data_size);
for (unsigned i = 0; i < nir_num_variable_modes; i++) {
if (BITFIELD_BIT(i) == nir_var_function_temp)
nir_variable_mode mode = BITFIELD_BIT(i);
if (mode == nir_var_function_temp)
continue;
nir_foreach_variable_with_modes(var, shader, BITFIELD_BIT(i))
print_var_decl(var, &state);
if (mode == nir_var_shader_in || mode == nir_var_shader_out) {
for (unsigned j = 0; j < 128; j++) {
nir_variable *vars[NIR_MAX_VEC_COMPONENTS] = {0};
nir_foreach_variable_with_modes(var, shader, mode) {
if (var->data.location == j)
vars[var->data.location_frac] = var;
}
for (unsigned j = 0; j < ARRAY_SIZE(vars); j++)
if (vars[j]) {
print_var_decl(vars[j], &state);
}
}
} else {
nir_foreach_variable_with_modes(var, shader, mode)
print_var_decl(var, &state);
}
}
foreach_list_typed(nir_function, func, node, &shader->functions) {