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 <thomashelland90@gmail.com>
This commit is contained in:
@@ -88,23 +88,23 @@ update_max_array_access(ir_rvalue *ir, int idx, YYLTYPE *loc,
|
||||
|
||||
if (deref_var != NULL) {
|
||||
if (deref_var->var->is_interface_instance()) {
|
||||
unsigned field_index =
|
||||
deref_record->record->type->field_index(deref_record->field);
|
||||
assert(field_index < deref_var->var->get_interface_type()->length);
|
||||
unsigned field_idx = deref_record->field_idx;
|
||||
assert(field_idx < deref_var->var->get_interface_type()->length);
|
||||
|
||||
int *const max_ifc_array_access =
|
||||
deref_var->var->get_max_ifc_array_access();
|
||||
|
||||
assert(max_ifc_array_access != NULL);
|
||||
|
||||
if (idx > max_ifc_array_access[field_index]) {
|
||||
max_ifc_array_access[field_index] = idx;
|
||||
if (idx > max_ifc_array_access[field_idx]) {
|
||||
max_ifc_array_access[field_idx] = idx;
|
||||
|
||||
/* Check whether this access will, as a side effect, implicitly
|
||||
* cause the size of a built-in array to be too large.
|
||||
*/
|
||||
check_builtin_array_max_size(deref_record->field, idx+1, *loc,
|
||||
state);
|
||||
const char *field_name =
|
||||
deref_record->record->type->fields.structure[field_idx].name;
|
||||
check_builtin_array_max_size(field_name, idx+1, *loc, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user