glsl: Check for zero vectors in ir_binop_dot

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Matt Turner 2012-06-04 16:17:12 -04:00
parent 82ce93a8fd
commit d7bef19c7f

View file

@ -309,6 +309,13 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
} }
break; 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: case ir_binop_logic_and:
/* FINISHME: Also simplify (a && a) to (a). */ /* FINISHME: Also simplify (a && a) to (a). */
if (is_vec_one(op_const[0])) { if (is_vec_one(op_const[0])) {