summaryrefslogtreecommitdiffstats
path: root/src/glsl/opt_algebraic.cpp
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-01-18 11:00:51 -0800
committerEric Anholt <[email protected]>2014-02-07 12:46:48 -0800
commit44577c48573acdbc8a708e6613f367507e9eafc5 (patch)
tree4dabf111ad4bcba72ad08b6e0c1da0b2ebbf994b /src/glsl/opt_algebraic.cpp
parentd72956790fed5f62b8eea5938ed432544530f7bd (diff)
glsl: Optimize lrp(x, x, coefficient) --> x.
total instructions in shared programs: 1627754 -> 1624534 (-0.20%) instructions in affected programs: 45748 -> 42528 (-7.04%) GAINED: 3 LOST: 0 (serious sam, humus domino demo) Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/glsl/opt_algebraic.cpp')
-rw-r--r--src/glsl/opt_algebraic.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index 953b03c2943..392051f4f05 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -553,6 +553,8 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
return ir->operands[0];
} else if (is_vec_one(op_const[2])) {
return ir->operands[1];
+ } else if (ir->operands[0]->equals(ir->operands[1])) {
+ return ir->operands[0];
}
break;