summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2015-01-23 14:47:50 -0800
committerEric Anholt <[email protected]>2015-01-23 17:30:01 -0800
commit6445a405201420698a3f6e292a3b2363fe7ff7f6 (patch)
tree9bc9a2d212fbca791e1234405f7c28b8dddeb47e /src
parent447ddfc1371b1ca6e8a9fe53ea8ea6bca6dbd795 (diff)
nir: When asked to print with a NULL state, just use bare variable names.
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glsl/nir/nir_print.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/glsl/nir/nir_print.c b/src/glsl/nir/nir_print.c
index 1a50ae92fe2..2ef55ed36f3 100644
--- a/src/glsl/nir/nir_print.c
+++ b/src/glsl/nir/nir_print.c
@@ -210,7 +210,9 @@ print_var_decl(nir_variable *var, print_var_state *state, FILE *fp)
glsl_print_type(var->type, fp);
- struct set_entry *entry = _mesa_set_search(state->syms, var->name);
+ struct set_entry *entry = NULL;
+ if (state)
+ entry = _mesa_set_search(state->syms, var->name);
char *name;
@@ -231,18 +233,26 @@ print_var_decl(nir_variable *var, print_var_state *state, FILE *fp)
fprintf(fp, "\n");
- _mesa_set_add(state->syms, name);
- _mesa_hash_table_insert(state->ht, var, name);
+ if (state) {
+ _mesa_set_add(state->syms, name);
+ _mesa_hash_table_insert(state->ht, var, name);
+ }
}
static void
print_var(nir_variable *var, print_var_state *state, FILE *fp)
{
- struct hash_entry *entry = _mesa_hash_table_search(state->ht, var);
+ const char *name;
+ if (state) {
+ struct hash_entry *entry = _mesa_hash_table_search(state->ht, var);
- assert(entry != NULL);
+ assert(entry != NULL);
+ name = entry->data;
+ } else {
+ name = var->name;
+ }
- fprintf(fp, "%s", (char *) entry->data);
+ fprintf(fp, "%s", name);
}
static void