summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/ir.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-08-09 13:34:04 +1000
committerTimothy Arceri <[email protected]>2017-08-11 10:43:21 +1000
commit49d9286a3f79800a94ddcffbe96a8894273db6d9 (patch)
tree1e5c6ee3530eeb1458f687d58c9b0db96510cb59 /src/compiler/glsl/ir.cpp
parent43cbcbfee9ab4a6aa1fbb51a1af7fd9619d3b7f5 (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.cpp')
-rw-r--r--src/compiler/glsl/ir.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp
index 98bbd915396..52ca83689e8 100644
--- a/src/compiler/glsl/ir.cpp
+++ b/src/compiler/glsl/ir.cpp
@@ -1104,10 +1104,8 @@ ir_constant::get_array_element(unsigned i) const
}
ir_constant *
-ir_constant::get_record_field(const char *name)
+ir_constant::get_record_field(int idx)
{
- int idx = this->type->field_index(name);
-
if (idx < 0)
return NULL;
@@ -1452,8 +1450,8 @@ ir_dereference_record::ir_dereference_record(ir_rvalue *value,
assert(value != NULL);
this->record = value;
- this->field = ralloc_strdup(this, field);
this->type = this->record->type->field_type(field);
+ this->field_idx = this->record->type->field_index(field);
}
@@ -1464,8 +1462,8 @@ ir_dereference_record::ir_dereference_record(ir_variable *var,
void *ctx = ralloc_parent(var);
this->record = new(ctx) ir_dereference_variable(var);
- this->field = ralloc_strdup(this, field);
this->type = this->record->type->field_type(field);
+ this->field_idx = this->record->type->field_index(field);
}
bool