[Mesa-dev] [PATCH 2/4] glsl: Add abs() to ir_builder.

Matt Turner mattst88 at gmail.com
Mon Aug 12 13:25:57 PDT 2013


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

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);
-- 
1.8.3.2



More information about the mesa-dev mailing list