diff options
author | Rob Clark <[email protected]> | 2015-09-17 18:18:45 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2015-09-17 20:26:12 -0400 |
commit | 5305603b9de52e59b9c5eec440f90a12cafa91a1 (patch) | |
tree | 3eef320bbec3804afa35eb0a541a5ee46daae339 /src/glsl | |
parent | ba78260b0fbd291618df63bc7a54be0a36148b40 (diff) |
nir/print: print variable names
Signed-off-by: Rob Clark <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/nir/nir_print.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/glsl/nir/nir_print.c b/src/glsl/nir/nir_print.c index ca8059fc920..6e86140ed9d 100644 --- a/src/glsl/nir/nir_print.c +++ b/src/glsl/nir/nir_print.c @@ -430,6 +430,36 @@ print_intrinsic_instr(nir_intrinsic_instr *instr, print_state *state) } fprintf(fp, ")"); + + if (!state->shader) + return; + + struct exec_list *var_list = NULL; + + switch (instr->intrinsic) { + case nir_intrinsic_load_uniform: + case nir_intrinsic_load_uniform_indirect: + var_list = &state->shader->uniforms; + break; + case nir_intrinsic_load_input: + case nir_intrinsic_load_input_indirect: + var_list = &state->shader->inputs; + break; + case nir_intrinsic_store_output: + case nir_intrinsic_store_output_indirect: + var_list = &state->shader->outputs; + break; + default: + return; + } + + foreach_list_typed(nir_variable, var, node, var_list) { + if ((var->data.driver_location == instr->const_index[0]) && + var->name) { + fprintf(fp, "\t/* %s */", var->name); + break; + } + } } static void |