From: Abdiel Janulgue Date: Fri, 20 Jun 2014 23:55:03 +0000 (-0700) Subject: glsl: Implement saturate as ir_unop_saturate X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cbd0d643a30901dabc5b3cc84121bafe16f8fc6f;p=mesa.git glsl: Implement saturate as ir_unop_saturate Now that we have the ir_unop_saturate implemented as a single instruction, generate the correct simplified expression. Reviewed-by: Matt Turner Reviewed-by: Ian Romanick Signed-off-by: Abdiel Janulgue --- diff --git a/src/glsl/ir_builder.cpp b/src/glsl/ir_builder.cpp index f03941443e0..a2f6f2967d1 100644 --- a/src/glsl/ir_builder.cpp +++ b/src/glsl/ir_builder.cpp @@ -271,11 +271,7 @@ clamp(operand a, operand b, operand c) ir_expression * saturate(operand a) { - void *mem_ctx = ralloc_parent(a.val); - - return expr(ir_binop_max, - expr(ir_binop_min, a, new(mem_ctx) ir_constant(1.0f)), - new(mem_ctx) ir_constant(0.0f)); + return expr(ir_unop_saturate, a); } ir_expression *