summaryrefslogtreecommitdiffstats
path: root/src/glsl/opt_algebraic.cpp
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2013-02-15 17:51:46 -0800
committerMatt Turner <[email protected]>2013-02-28 13:18:59 -0800
commitaf2c64063e7fb31b243d63b77e09cd19c3819d72 (patch)
treede153c040fd705fd1b3aa20e849f422b52090317 /src/glsl/opt_algebraic.cpp
parent93066ce1299a7be8f670e527f249940c635605b4 (diff)
glsl: Optimize ir_triop_lrp(x, y, a) with a = 0.0f or 1.0f
Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/opt_algebraic.cpp')
-rw-r--r--src/glsl/opt_algebraic.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index 44a21b6c335..70e016d22aa 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -415,6 +415,17 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
break;
+ case ir_triop_lrp:
+ /* Operands are (x, y, a). */
+ if (is_vec_zero(op_const[2])) {
+ this->progress = true;
+ return swizzle_if_required(ir, ir->operands[0]);
+ } else if (is_vec_one(op_const[2])) {
+ this->progress = true;
+ return swizzle_if_required(ir, ir->operands[1]);
+ }
+ break;
+
default:
break;
}