aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/opt_algebraic.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-10-24 08:10:01 +0200
committermarha <marha@users.sourceforge.net>2013-10-24 08:10:01 +0200
commit4eb0b643ad978d94837e2d587a5d4358f974a25c (patch)
treeecb04ee3cf0d7c2fa80707218382d68e7a49f621 /mesalib/src/glsl/opt_algebraic.cpp
parent6d895f30ab93d71afddc612d8b007f2de7f04165 (diff)
downloadvcxsrv-4eb0b643ad978d94837e2d587a5d4358f974a25c.tar.gz
vcxsrv-4eb0b643ad978d94837e2d587a5d4358f974a25c.tar.bz2
vcxsrv-4eb0b643ad978d94837e2d587a5d4358f974a25c.zip
fontconfig mesa xserver git update 24 oct 2013
xserver commit 7ecfab47eb221dbb996ea6c033348b8eceaeb893 fontconfig commit 76ea9af816a50c6bb0b3dc2960460a90fadd9cdb mesa commit a6e45b6a17462f4d261a2d176791469847356923
Diffstat (limited to 'mesalib/src/glsl/opt_algebraic.cpp')
-rw-r--r--mesalib/src/glsl/opt_algebraic.cpp40
1 files changed, 32 insertions, 8 deletions
diff --git a/mesalib/src/glsl/opt_algebraic.cpp b/mesalib/src/glsl/opt_algebraic.cpp
index 3e5802e18..37b2f02c6 100644
--- a/mesalib/src/glsl/opt_algebraic.cpp
+++ b/mesalib/src/glsl/opt_algebraic.cpp
@@ -210,6 +210,34 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
this->mem_ctx = ralloc_parent(ir);
switch (ir->operation) {
+ case ir_unop_abs:
+ if (op_expr[0] == NULL)
+ break;
+
+ switch (op_expr[0]->operation) {
+ case ir_unop_abs:
+ case ir_unop_neg:
+ this->progress = true;
+ temp = new(mem_ctx) ir_expression(ir_unop_abs,
+ ir->type,
+ op_expr[0]->operands[0],
+ NULL);
+ return swizzle_if_required(ir, temp);
+ default:
+ break;
+ }
+ 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;
@@ -257,11 +285,9 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
* folding.
*/
if (op_const[0] && !op_const[1])
- reassociate_constant(ir, 0, op_const[0],
- ir->operands[1]->as_expression());
+ reassociate_constant(ir, 0, op_const[0], op_expr[1]);
if (op_const[1] && !op_const[0])
- reassociate_constant(ir, 1, op_const[1],
- ir->operands[0]->as_expression());
+ reassociate_constant(ir, 1, op_const[1], op_expr[0]);
break;
case ir_binop_sub:
@@ -315,11 +341,9 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
* constant folding.
*/
if (op_const[0] && !op_const[1])
- reassociate_constant(ir, 0, op_const[0],
- ir->operands[1]->as_expression());
+ reassociate_constant(ir, 0, op_const[0], op_expr[1]);
if (op_const[1] && !op_const[0])
- reassociate_constant(ir, 1, op_const[1],
- ir->operands[0]->as_expression());
+ reassociate_constant(ir, 1, op_const[1], op_expr[0]);
break;