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>
This commit is contained in:
Kenneth Graunke
2013-09-03 16:37:39 -07:00
parent 7f0f60cd84
commit eff2ca1ac3
2 changed files with 9 additions and 0 deletions
+8
View File
@@ -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);