[Mesa-dev] [PATCH 11/21] glsl: Add IR builder support for triops.

Kenneth Graunke kenneth at whitecape.org
Wed Sep 4 15:22:34 PDT 2013


Now that we have the ir_expression constructor that does type inference,
this is trivial to do.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/glsl/ir_builder.cpp | 8 ++++++++
 src/glsl/ir_builder.h   | 1 +
 2 files changed, 9 insertions(+)

diff --git a/src/glsl/ir_builder.cpp b/src/glsl/ir_builder.cpp
index 7d9cf5e..87f5790 100644
--- a/src/glsl/ir_builder.cpp
+++ b/src/glsl/ir_builder.cpp
@@ -173,6 +173,14 @@ expr(ir_expression_operation op, operand a, operand b)
    return new(mem_ctx) ir_expression(op, a.val, b.val);
 }
 
+ir_expression *
+expr(ir_expression_operation op, operand a, operand b, operand c)
+{
+   void *mem_ctx = ralloc_parent(a.val);
+
+   return new(mem_ctx) ir_expression(op, a.val, b.val, c.val);
+}
+
 ir_expression *add(operand a, operand b)
 {
    return expr(ir_binop_add, a, b);
diff --git a/src/glsl/ir_builder.h b/src/glsl/ir_builder.h
index 7049476..6c0b5a1 100644
--- a/src/glsl/ir_builder.h
+++ b/src/glsl/ir_builder.h
@@ -125,6 +125,7 @@ ir_assignment *assign(deref lhs, operand rhs, int writemask);
 
 ir_expression *expr(ir_expression_operation op, operand a);
 ir_expression *expr(ir_expression_operation op, operand a, operand b);
+ir_expression *expr(ir_expression_operation op, operand a, operand b, operand c);
 ir_expression *add(operand a, operand b);
 ir_expression *sub(operand a, operand b);
 ir_expression *mul(operand a, operand b);
-- 
1.8.3.4



More information about the mesa-dev mailing list