summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2015-07-04 22:40:58 +0100
committerEmil Velikov <emil.l.velikov@gmail.com>2015-07-08 13:36:46 +0100
commit5de0e9f982de9cbb6823b7a3d130bb632a16b2ae (patch)
treeb7749b0180e3c3413e364fcf25f15dbaaf089e94 /src
parent083840d365e079ec4b63911dc4b4fb8dda5b98d2 (diff)
glsl: Add missing check for whether an expression is an add operation
There is a piece of code that is trying to match expressions of the form (mul (floor (add (abs x) 0.5) (sign x))). However the check for the add expression wasn't checking whether it had the expected operation. It looks like this was just an oversight because it doesn't match the pattern for the rest of the code snippet. The existing line to check whether add_expr!=NULL was added as part of a coverity fix in 3384179f. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91226 Cc: Matt Turner <mattst88@gmail.com> Cc: "10.6" <mesa-stable@lists.freedesktop.org> Reviewed-by: Matt Turner <mattst88@gmail.com> (cherry picked from commit 18039078e0254c7cb5e15b7186be05e2e4c10f38)
Diffstat (limited to 'src')
-rw-r--r--src/glsl/opt_algebraic.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index fa5db70f2dd..9b8a426d79c 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -580,7 +580,7 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
continue;
ir_expression *add_expr = floor_expr->operands[0]->as_expression();
- if (!add_expr)
+ if (!add_expr || add_expr->operation != ir_binop_add)
continue;
for (int j = 0; j < 2; j++) {