aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/program
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-08-09 13:34:02 +1000
committerTimothy Arceri <[email protected]>2017-08-11 10:43:12 +1000
commite2e2c5abd279df1b3aa99c52b81c9cb48fea35fb (patch)
tree814dcc8cf5c292ebaead53f75580c93b7f95f1ce /src/mesa/program
parent5563872dbfbf733ed56e1b367bc8944ca59b1c3e (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/mesa/program')
-rw-r--r--src/mesa/program/ir_to_mesa.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index ac12b59d075..db7f11c6bf2 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -1004,7 +1004,7 @@ ir_to_mesa_visitor::visit(ir_expression *ir)
return;
}
- for (operand = 0; operand < ir->get_num_operands(); operand++) {
+ for (operand = 0; operand < ir->num_operands; operand++) {
this->result.file = PROGRAM_UNDEFINED;
ir->operands[operand]->accept(this);
if (this->result.file == PROGRAM_UNDEFINED) {
@@ -1736,7 +1736,7 @@ ir_to_mesa_visitor::process_move_condition(ir_rvalue *ir)
bool switch_order = false;
ir_expression *const expr = ir->as_expression();
- if ((expr != NULL) && (expr->get_num_operands() == 2)) {
+ if ((expr != NULL) && (expr->num_operands == 2)) {
bool zero_on_left = false;
if (expr->operands[0]->is_zero()) {