summaryrefslogtreecommitdiffstats
path: root/src/glsl/opt_algebraic.cpp
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2012-06-04 16:17:12 -0400
committerMatt Turner <[email protected]>2012-06-12 18:51:25 -0400
commitd7bef19c7ff40f0b83a42fdb8509eed3ad1e40a3 (patch)
treec3fbdadc57224ec7285228f84845f0a284fff30a /src/glsl/opt_algebraic.cpp
parent82ce93a8fdcb18b17263a388fa0bd8dbc1889857 (diff)
glsl: Check for zero vectors in ir_binop_dot
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/opt_algebraic.cpp')
-rw-r--r--src/glsl/opt_algebraic.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index d3976126050..5a9881dbebe 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -309,6 +309,13 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
}
break;
+ case ir_binop_dot:
+ if (is_vec_zero(op_const[0]) || is_vec_zero(op_const[1])) {
+ this->progress = true;
+ return ir_constant::zero(mem_ctx, ir->type);
+ }
+ break;
+
case ir_binop_logic_and:
/* FINISHME: Also simplify (a && a) to (a). */
if (is_vec_one(op_const[0])) {