[Mesa-dev] [PATCH 3/8] glsl: add min() and max() functions to builder.cpp

=?UTF-8?q?Maxence=20Le=20Dor=C3=A9?= <Maxence Le Doré> maxence.ledore at gmail.com
Thu Jan 2 15:09:50 PST 2014


---
 src/glsl/ir_builder.cpp | 10 ++++++++++
 src/glsl/ir_builder.h   |  3 +++
 2 files changed, 13 insertions(+)

diff --git a/src/glsl/ir_builder.cpp b/src/glsl/ir_builder.cpp
index 6c49734..31ed191 100644
--- a/src/glsl/ir_builder.cpp
+++ b/src/glsl/ir_builder.cpp
@@ -211,6 +211,16 @@ ir_expression *sub(operand a, operand b)
    return expr(ir_binop_sub, a, b);
 }
 
+ir_expression *min(operand a, operand b)
+{
+   return expr(ir_binop_min, a, b);
+}
+
+ir_expression *max(operand a, operand b)
+{
+   return expr(ir_binop_max, a, b);
+}
+
 ir_expression *mul(operand a, operand b)
 {
    return expr(ir_binop_mul, a, b);
diff --git a/src/glsl/ir_builder.h b/src/glsl/ir_builder.h
index 1f07788..4b85ea1 100644
--- a/src/glsl/ir_builder.h
+++ b/src/glsl/ir_builder.h
@@ -184,6 +184,9 @@ ir_expression *i2b(operand a);
 ir_expression *f2b(operand a);
 ir_expression *b2f(operand a);
 
+ir_expression *min(operand a, operand b);
+ir_expression *max(operand a, operand b);
+
 ir_expression *fma(operand a, operand b, operand c);
 ir_expression *lrp(operand x, operand y, operand a);
 ir_expression *csel(operand a, operand b, operand c);
-- 
1.8.5.2



More information about the mesa-dev mailing list