diff options
author | Timothy Arceri <[email protected]> | 2017-08-09 13:34:02 +1000 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-08-11 10:43:12 +1000 |
commit | e2e2c5abd279df1b3aa99c52b81c9cb48fea35fb (patch) | |
tree | 814dcc8cf5c292ebaead53f75580c93b7f95f1ce /src/compiler/glsl/ir_clone.cpp | |
parent | 5563872dbfbf733ed56e1b367bc8944ca59b1c3e (diff) |
glsl: calculate number of operands in an expression once
Extra validation is added to ir_validate to make sure this is
always updated to the correct numer of operands, as passes like
lower_instructions modify the instructions directly rather then
generating a new one.
The reduction in time is so small that it is not really
measurable. However callgrind was reporting this function as
being called just under 34 million times while compiling the
Deus Ex shaders (just pre-linking was profiled) with 0.20%
spent in this function.
v2:
- make num_operands a unit8_t
- fix unsigned/signed mismatches
Reviewed-by: Thomas Helland <[email protected]>
Diffstat (limited to 'src/compiler/glsl/ir_clone.cpp')
-rw-r--r-- | src/compiler/glsl/ir_clone.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/compiler/glsl/ir_clone.cpp b/src/compiler/glsl/ir_clone.cpp index a64c7afa944..941e0865cb5 100644 --- a/src/compiler/glsl/ir_clone.cpp +++ b/src/compiler/glsl/ir_clone.cpp @@ -160,7 +160,7 @@ ir_expression::clone(void *mem_ctx, struct hash_table *ht) const ir_rvalue *op[ARRAY_SIZE(this->operands)] = { NULL, }; unsigned int i; - for (i = 0; i < get_num_operands(); i++) { + for (i = 0; i < num_operands; i++) { op[i] = this->operands[i]->clone(mem_ctx, ht); } |