From: Matt Turner Date: Sat, 16 Feb 2013 01:51:46 +0000 (-0800) Subject: glsl: Optimize ir_triop_lrp(x, y, a) with a = 0.0f or 1.0f X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=af2c64063e7fb31b243d63b77e09cd19c3819d72;p=mesa.git glsl: Optimize ir_triop_lrp(x, y, a) with a = 0.0f or 1.0f Reviewed-by: Eric Anholt Reviewed-by: Kenneth Graunke --- diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 44a21b6c335..70e016d22aa 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -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; }