diff options
author | Timothy Arceri <[email protected]> | 2017-08-09 13:34:04 +1000 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-08-11 10:43:21 +1000 |
commit | 49d9286a3f79800a94ddcffbe96a8894273db6d9 (patch) | |
tree | 1e5c6ee3530eeb1458f687d58c9b0db96510cb59 /src/compiler/glsl/ir_print_visitor.cpp | |
parent | 43cbcbfee9ab4a6aa1fbb51a1af7fd9619d3b7f5 (diff) |
glsl: stop copying struct and interface member names
We are currently copying the name for each member dereference
but we can just share a single instance of the string provided
by the type.
This change also stops us recalculating the field index
repeatedly.
Reviewed-by: Thomas Helland <[email protected]>
Diffstat (limited to 'src/compiler/glsl/ir_print_visitor.cpp')
-rw-r--r-- | src/compiler/glsl/ir_print_visitor.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/compiler/glsl/ir_print_visitor.cpp b/src/compiler/glsl/ir_print_visitor.cpp index a32a4109190..64aeaee2869 100644 --- a/src/compiler/glsl/ir_print_visitor.cpp +++ b/src/compiler/glsl/ir_print_visitor.cpp @@ -423,7 +423,10 @@ void ir_print_visitor::visit(ir_dereference_record *ir) { fprintf(f, "(record_ref "); ir->record->accept(this); - fprintf(f, " %s) ", ir->field); + + const char *field_name = + ir->record->type->fields.structure[ir->field_idx].name; + fprintf(f, " %s) ", field_name); } |