glsl: Optimize ir_triop_lrp(x, y, a) with a = 0.0f or 1.0f

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Matt Turner 2013-02-15 17:51:46 -08:00
parent 93066ce129
commit af2c64063e
1 changed files with 11 additions and 0 deletions

View File

@ -415,6 +415,17 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
break;
case ir_triop_lrp:
/* Operands are (x, y, a). */
if (is_vec_zero(op_const[2])) {
this->progress = true;
return swizzle_if_required(ir, ir->operands[0]);
} else if (is_vec_one(op_const[2])) {
this->progress = true;
return swizzle_if_required(ir, ir->operands[1]);
}
break;
default:
break;
}