mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-02 19:20:32 +01:00
glsl/ir_builder: Add a generic constructor for unary expressions.
I needed to compute logs and square roots in a patch I was working on, and wanted to use the convenient interface. We already have a similar constructor for binops; adding one for unops seems reasonable. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
b656df990f
commit
0bb3d4ba54
2 changed files with 9 additions and 0 deletions
|
|
@ -142,6 +142,14 @@ swizzle_xyzw(operand a)
|
|||
return swizzle(a, SWIZZLE_XYZW, 4);
|
||||
}
|
||||
|
||||
ir_expression *
|
||||
expr(ir_expression_operation op, operand a)
|
||||
{
|
||||
void *mem_ctx = ralloc_parent(a.val);
|
||||
|
||||
return new(mem_ctx) ir_expression(op, a.val);
|
||||
}
|
||||
|
||||
ir_expression *
|
||||
expr(ir_expression_operation op, operand a, operand b)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ public:
|
|||
ir_assignment *assign(deref lhs, operand rhs);
|
||||
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 *add(operand a, operand b);
|
||||
ir_expression *sub(operand a, operand b);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue