[Mesa-dev] [PATCH 3/3] glsl: Optimize -(-expr) into expr.
Matt Turner
mattst88 at gmail.com
Thu Oct 17 01:56:45 CEST 2013
---
src/glsl/opt_algebraic.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index 9b0596c..37b2f02 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -228,6 +228,16 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
}
break;
+ case ir_unop_neg:
+ if (op_expr[0] == NULL)
+ break;
+
+ if (op_expr[0]->operation == ir_unop_neg) {
+ this->progress = true;
+ return swizzle_if_required(ir, op_expr[0]->operands[0]);
+ }
+ break;
+
case ir_unop_logic_not: {
enum ir_expression_operation new_op = ir_unop_logic_not;
--
1.8.3.2
More information about the mesa-dev
mailing list