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/opt_structure_splitting.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/opt_structure_splitting.cpp')
-rw-r--r-- | src/compiler/glsl/opt_structure_splitting.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/compiler/glsl/opt_structure_splitting.cpp b/src/compiler/glsl/opt_structure_splitting.cpp index 84394303874..a015d6d7c93 100644 --- a/src/compiler/glsl/opt_structure_splitting.cpp +++ b/src/compiler/glsl/opt_structure_splitting.cpp @@ -233,13 +233,9 @@ ir_structure_splitting_visitor::split_deref(ir_dereference **deref) if (!entry) return; - unsigned int i; - for (i = 0; i < entry->var->type->length; i++) { - if (strcmp(deref_record->field, - entry->var->type->fields.structure[i].name) == 0) - break; - } - assert(i != entry->var->type->length); + int i = deref_record->field_idx; + assert(i >= 0); + assert((unsigned) i < entry->var->type->length); *deref = new(entry->mem_ctx) ir_dereference_variable(entry->components[i]); } |