diff options
author | Kenneth Graunke <[email protected]> | 2013-09-03 16:41:42 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2013-09-09 11:52:22 -0700 |
commit | f72a8498e7e2c2d3233cdfd58de3b1124a247d39 (patch) | |
tree | be0eccff93bfd952aea470bf0d9343b90aba9d12 /src/glsl/ir_builder.cpp | |
parent | eff2ca1ac3f77da81a698b08c46f245b28930ede (diff) |
glsl: Add IR builder support for conditional assignments.
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 <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Paul Berry <[email protected]>
Diffstat (limited to 'src/glsl/ir_builder.cpp')
-rw-r--r-- | src/glsl/ir_builder.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/glsl/ir_builder.cpp b/src/glsl/ir_builder.cpp index 87f57901bec..b2b926b610f 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) { |