From: Matt Turner Date: Mon, 4 Jun 2012 20:17:12 +0000 (-0400) Subject: glsl: Check for zero vectors in ir_binop_dot X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d7bef19c7ff40f0b83a42fdb8509eed3ad1e40a3;p=mesa.git glsl: Check for zero vectors in ir_binop_dot Reviewed-by: Kenneth Graunke --- 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])) {