summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdiel Janulgue <abdiel.janulgue@linux.intel.com>2014-06-20 16:55:03 -0700
committerAbdiel Janulgue <abdiel.janulgue@linux.intel.com>2014-08-21 14:36:35 +0300
commit85a0fb0efb601fd08edf9bf7213fe8e74d3a3811 (patch)
tree05c34a20a896f339e9a7d1635b52d9419798a764
parent9520060fb04a6c86ea54572c7d149119c227799d (diff)
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 <mattst88@gmail.com> Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
-rw-r--r--src/glsl/ir_builder.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/glsl/ir_builder.cpp b/src/glsl/ir_builder.cpp
index f03941443e..a2f6f2967d 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 *