Module: Mesa Branch: main Commit: 40f22f8ecd4980ef7d0798ccf6e24e6cc142c5c5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=40f22f8ecd4980ef7d0798ccf6e24e6cc142c5c5
Author: Emma Anholt <[email protected]> Date: Tue Oct 10 10:47:59 2023 -0700 nir/print: Decode system values in the variable declarations. decl_var system INTERP_MODE_NONE none vec4 #0 decl_var system INTERP_MODE_FLAT none mediump uint #1 turns into: decl_var system INTERP_MODE_NONE none vec4 #0 (SYSTEM_VALUE_FRAG_COORD) decl_var system INTERP_MODE_FLAT none mediump uint #1 (SYSTEM_VALUE_SUBGROUP_INVOCATION) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25647> --- src/compiler/nir/nir_print.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index 80414ca4f15..29546d03d36 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -776,6 +776,9 @@ get_location_str(unsigned location, gl_shader_stage stage, break; } + if (mode == nir_var_system_value) + return gl_system_value_name(location); + if (location == ~0) { return "~0"; } else { @@ -859,6 +862,7 @@ print_var_decl(nir_variable *var, print_state *state) if (var->data.mode & (nir_var_shader_in | nir_var_shader_out | nir_var_uniform | + nir_var_system_value | nir_var_mem_ubo | nir_var_mem_ssbo | nir_var_image)) { @@ -872,7 +876,7 @@ print_var_decl(nir_variable *var, print_state *state) */ unsigned int num_components = glsl_get_components(glsl_without_array(var->type)); - const char *components = NULL; + const char *components = ""; char components_local[18] = { '.' /* the rest is 0-filled */ }; switch (var->data.mode) { case nir_var_shader_in: @@ -889,10 +893,14 @@ print_var_decl(nir_variable *var, print_state *state) break; } - fprintf(fp, " (%s%s, %u, %u)%s", loc, - components ? components : "", - var->data.driver_location, var->data.binding, - var->data.compact ? " compact" : ""); + if (var->data.mode & nir_var_system_value) { + fprintf(fp, " (%s%s)", loc, components); + } else { + fprintf(fp, " (%s%s, %u, %u)%s", loc, + components, + var->data.driver_location, var->data.binding, + var->data.compact ? " compact" : ""); + } } if (var->constant_initializer) {
