Mesa (master): glsl: Add abs() to ir_builder.

Matt Turner mattst88 at kemper.freedesktop.org
Thu Aug 15 00:14:22 UTC 2013


Module: Mesa
Branch: master
Commit: 16be6298c0d7aa1a06903e6768bc74358d339fba
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=16be6298c0d7aa1a06903e6768bc74358d339fba

Author: Matt Turner <mattst88 at gmail.com>
Date:   Sun Aug  4 14:09:09 2013 -0700

glsl: Add abs() to ir_builder.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Chad Versace <chad.versace at linux.intel.com>

---

 src/glsl/ir_builder.cpp |    6 ++++++
 src/glsl/ir_builder.h   |    1 +
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ir_builder.cpp b/src/glsl/ir_builder.cpp
index 5e1da17..06b6a8c 100644
--- a/src/glsl/ir_builder.cpp
+++ b/src/glsl/ir_builder.cpp
@@ -219,6 +219,12 @@ saturate(operand a)
 	       new(mem_ctx) ir_constant(0.0f));
 }
 
+ir_expression *
+abs(operand a)
+{
+   return expr(ir_unop_abs, a);
+}
+
 ir_expression*
 equal(operand a, operand b)
 {
diff --git a/src/glsl/ir_builder.h b/src/glsl/ir_builder.h
index 59985be..49c2a73 100644
--- a/src/glsl/ir_builder.h
+++ b/src/glsl/ir_builder.h
@@ -133,6 +133,7 @@ ir_expression *round_even(operand a);
 ir_expression *dot(operand a, operand b);
 ir_expression *clamp(operand a, operand b, operand c);
 ir_expression *saturate(operand a);
+ir_expression *abs(operand a);
 
 ir_expression *equal(operand a, operand b);
 ir_expression *less(operand a, operand b);




More information about the mesa-commit mailing list