summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2014-01-05 22:19:42 -0800
committerKenneth Graunke <[email protected]>2014-01-07 12:54:57 -0800
commitd6c1d66d3a74e25435b5ebcde208e8049b669120 (patch)
tree88007dfa70d208e86651000976387a5192510cac /src
parent05fbb021a6329add4b37c876c0621c1dcc3d4ef9 (diff)
glsl: Optimize pow(1.0, X) --> 1.0.
Surprisingly, this helps one vertex shader in 3DMMES. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glsl/opt_algebraic.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index 05a58998985..5e885f78648 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -416,6 +416,12 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
}
break;
+ case ir_binop_pow:
+ /* 1^x == 1 */
+ if (is_vec_one(op_const[0]))
+ return op_const[0];
+ break;
+
case ir_unop_rcp:
if (op_expr[0] && op_expr[0]->operation == ir_unop_rcp)
return op_expr[0]->operands[0];