aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/opt_algebraic.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-10-18 11:23:37 +0200
committermarha <marha@users.sourceforge.net>2013-10-18 11:23:37 +0200
commitb8a77c943fa53005b6cdb1ab792acf5ff0a131be (patch)
treee10b1a509f6773de3e547ac5332cf6e0a4e07617 /mesalib/src/glsl/opt_algebraic.cpp
parent9e23b44bfe1e6e85231b1c07d945cadf0c868648 (diff)
downloadvcxsrv-b8a77c943fa53005b6cdb1ab792acf5ff0a131be.tar.gz
vcxsrv-b8a77c943fa53005b6cdb1ab792acf5ff0a131be.tar.bz2
vcxsrv-b8a77c943fa53005b6cdb1ab792acf5ff0a131be.zip
mesa pixman git update 18 okt 2013
pixman commit 3c2f4b651747c1ac484c39d5128cae5483094342 mesa commit 9aad1ba70fad7bfa45778faa5a91235f8302264f
Diffstat (limited to 'mesalib/src/glsl/opt_algebraic.cpp')
-rw-r--r--mesalib/src/glsl/opt_algebraic.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/mesalib/src/glsl/opt_algebraic.cpp b/mesalib/src/glsl/opt_algebraic.cpp
index d706a6ad1..3e5802e18 100644
--- a/mesalib/src/glsl/opt_algebraic.cpp
+++ b/mesalib/src/glsl/opt_algebraic.cpp
@@ -85,6 +85,12 @@ is_vec_one(ir_constant *ir)
}
static inline bool
+is_vec_negative_one(ir_constant *ir)
+{
+ return (ir == NULL) ? false : ir->is_negative_one();
+}
+
+static inline bool
is_vec_basis(ir_constant *ir)
{
return (ir == NULL) ? false : ir->is_basis();
@@ -287,6 +293,23 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
this->progress = true;
return ir_constant::zero(ir, ir->type);
}
+ if (is_vec_negative_one(op_const[0])) {
+ this->progress = true;
+ temp = new(mem_ctx) ir_expression(ir_unop_neg,
+ ir->operands[1]->type,
+ ir->operands[1],
+ NULL);
+ return swizzle_if_required(ir, temp);
+ }
+ if (is_vec_negative_one(op_const[1])) {
+ this->progress = true;
+ temp = new(mem_ctx) ir_expression(ir_unop_neg,
+ ir->operands[0]->type,
+ ir->operands[0],
+ NULL);
+ return swizzle_if_required(ir, temp);
+ }
+
/* Reassociate multiplication of constants so that we can do
* constant folding.