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/linker.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/linker.cpp')
-rw-r--r-- | src/compiler/glsl/linker.cpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index b4784c51199..5f22eb36ae6 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -248,14 +248,7 @@ public: virtual ir_visitor_status visit_leave(ir_dereference_record *ir) { - for (unsigned i = 0; i < ir->record->type->length; i++) { - const struct glsl_struct_field *field = - &ir->record->type->fields.structure[i]; - if (strcmp(field->name, ir->field) == 0) { - ir->type = field->type; - break; - } - } + ir->type = ir->record->type->fields.structure[ir->field_idx].type; return visit_continue; } }; |