diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2013-09-03 16:37:39 -0700 |
---|---|---|
committer | Kenneth Graunke <kenneth@whitecape.org> | 2013-09-09 11:52:22 -0700 |
commit | eff2ca1ac3f77da81a698b08c46f245b28930ede (patch) | |
tree | 44b016fe7775a7dc0583fc1647dee3ea21647e78 | |
parent | 7f0f60cd840fc88f01b8f6e46cad36c36709d813 (diff) |
glsl: Add IR builder support for triops.
Now that we have the ir_expression constructor that does type inference,
this is trivial to do.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
-rw-r--r-- | src/glsl/ir_builder.cpp | 8 | ||||
-rw-r--r-- | src/glsl/ir_builder.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/glsl/ir_builder.cpp b/src/glsl/ir_builder.cpp index 7d9cf5e472..87f57901be 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 7049476a1c..6c0b5a189b 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); |