This adds two new signatures:

   assign(lhs, rhs, condition, writemask);
   assign(lhs, rhs, condition);

All the other existing APIs still exist.

Signed-off-by: Kenneth Graunke <kenn...@whitecape.org>
---
 src/glsl/ir_builder.cpp | 17 +++++++++++++++--
 src/glsl/ir_builder.h   |  2 ++
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/glsl/ir_builder.cpp b/src/glsl/ir_builder.cpp
index 87f5790..b2b926b 100644
--- a/src/glsl/ir_builder.cpp
+++ b/src/glsl/ir_builder.cpp
@@ -46,13 +46,14 @@ ir_factory::make_temp(const glsl_type *type, const char 
*name)
 }
 
 ir_assignment *
-assign(deref lhs, operand rhs, int writemask)
+assign(deref lhs, operand rhs, operand condition, int writemask)
 {
    void *mem_ctx = ralloc_parent(lhs.val);
 
    ir_assignment *assign = new(mem_ctx) ir_assignment(lhs.val,
                                                      rhs.val,
-                                                     NULL, writemask);
+                                                      condition.val,
+                                                      writemask);
 
    return assign;
 }
@@ -63,6 +64,18 @@ assign(deref lhs, operand rhs)
    return assign(lhs, rhs, (1 << lhs.val->type->vector_elements) - 1);
 }
 
+ir_assignment *
+assign(deref lhs, operand rhs, int writemask)
+{
+   return assign(lhs, rhs, (ir_rvalue *) NULL, writemask);
+}
+
+ir_assignment *
+assign(deref lhs, operand rhs, operand condition)
+{
+   return assign(lhs, rhs, condition, (1 << lhs.val->type->vector_elements) - 
1);
+}
+
 ir_swizzle *
 swizzle(operand a, int swizzle, int components)
 {
diff --git a/src/glsl/ir_builder.h b/src/glsl/ir_builder.h
index 6c0b5a1..c852849 100644
--- a/src/glsl/ir_builder.h
+++ b/src/glsl/ir_builder.h
@@ -122,6 +122,8 @@ public:
 
 ir_assignment *assign(deref lhs, operand rhs);
 ir_assignment *assign(deref lhs, operand rhs, int writemask);
+ir_assignment *assign(deref lhs, operand rhs, operand condition);
+ir_assignment *assign(deref lhs, operand rhs, operand condition, int 
writemask);
 
 ir_expression *expr(ir_expression_operation op, operand a);
 ir_expression *expr(ir_expression_operation op, operand a, operand b);
-- 
1.8.3.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to