mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 02:10:11 +01:00
glsl: Add IR builder shortcuts for a bunch of random opcodes.
Adding new convenience emitters makes it easier to generate IR involving
these opcodes.
bitfield_insert is particularly useful, since there is no expr() for
quadops.
v2: Add fma() and rename lrp() operands to x/y/a to match the GLSL
specification (suggested by Matt Turner). Fix whitespace issues.
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:
parent
1a6c0efa11
commit
666df56551
2 changed files with 94 additions and 0 deletions
|
|
@ -264,6 +264,54 @@ abs(operand a)
|
|||
return expr(ir_unop_abs, a);
|
||||
}
|
||||
|
||||
ir_expression *
|
||||
neg(operand a)
|
||||
{
|
||||
return expr(ir_unop_neg, a);
|
||||
}
|
||||
|
||||
ir_expression *
|
||||
sin(operand a)
|
||||
{
|
||||
return expr(ir_unop_sin, a);
|
||||
}
|
||||
|
||||
ir_expression *
|
||||
cos(operand a)
|
||||
{
|
||||
return expr(ir_unop_cos, a);
|
||||
}
|
||||
|
||||
ir_expression *
|
||||
exp(operand a)
|
||||
{
|
||||
return expr(ir_unop_exp, a);
|
||||
}
|
||||
|
||||
ir_expression *
|
||||
rsq(operand a)
|
||||
{
|
||||
return expr(ir_unop_rsq, a);
|
||||
}
|
||||
|
||||
ir_expression *
|
||||
sqrt(operand a)
|
||||
{
|
||||
return expr(ir_unop_sqrt, a);
|
||||
}
|
||||
|
||||
ir_expression *
|
||||
log(operand a)
|
||||
{
|
||||
return expr(ir_unop_log, a);
|
||||
}
|
||||
|
||||
ir_expression *
|
||||
sign(operand a)
|
||||
{
|
||||
return expr(ir_unop_sign, a);
|
||||
}
|
||||
|
||||
ir_expression*
|
||||
equal(operand a, operand b)
|
||||
{
|
||||
|
|
@ -420,6 +468,38 @@ b2i(operand a)
|
|||
return expr(ir_unop_b2i, a);
|
||||
}
|
||||
|
||||
ir_expression *
|
||||
f2b(operand a)
|
||||
{
|
||||
return expr(ir_unop_f2b, a);
|
||||
}
|
||||
|
||||
ir_expression *
|
||||
b2f(operand a)
|
||||
{
|
||||
return expr(ir_unop_b2f, a);
|
||||
}
|
||||
|
||||
ir_expression *
|
||||
fma(operand a, operand b, operand c)
|
||||
{
|
||||
return expr(ir_triop_fma, a, b, c);
|
||||
}
|
||||
|
||||
ir_expression *
|
||||
lrp(operand x, operand y, operand a)
|
||||
{
|
||||
return expr(ir_triop_lrp, x, y, a);
|
||||
}
|
||||
|
||||
ir_expression *
|
||||
bitfield_insert(operand a, operand b, operand c, operand d)
|
||||
{
|
||||
void *mem_ctx = ralloc_parent(a.val);
|
||||
return new(mem_ctx) ir_expression(ir_quadop_bitfield_insert,
|
||||
a.val->type, a.val, b.val, c.val, d.val);
|
||||
}
|
||||
|
||||
ir_if*
|
||||
if_tree(operand condition,
|
||||
ir_instruction *then_branch)
|
||||
|
|
|
|||
|
|
@ -140,6 +140,14 @@ ir_expression *dotlike(operand a, operand b);
|
|||
ir_expression *clamp(operand a, operand b, operand c);
|
||||
ir_expression *saturate(operand a);
|
||||
ir_expression *abs(operand a);
|
||||
ir_expression *neg(operand a);
|
||||
ir_expression *sin(operand a);
|
||||
ir_expression *cos(operand a);
|
||||
ir_expression *exp(operand a);
|
||||
ir_expression *rsq(operand a);
|
||||
ir_expression *sqrt(operand a);
|
||||
ir_expression *log(operand a);
|
||||
ir_expression *sign(operand a);
|
||||
|
||||
ir_expression *equal(operand a, operand b);
|
||||
ir_expression *nequal(operand a, operand b);
|
||||
|
|
@ -170,6 +178,12 @@ ir_expression *i2u(operand a);
|
|||
ir_expression *u2i(operand a);
|
||||
ir_expression *b2i(operand a);
|
||||
ir_expression *i2b(operand a);
|
||||
ir_expression *f2b(operand a);
|
||||
ir_expression *b2f(operand a);
|
||||
|
||||
ir_expression *fma(operand a, operand b, operand c);
|
||||
ir_expression *lrp(operand x, operand y, operand a);
|
||||
ir_expression *bitfield_insert(operand a, operand b, operand c, operand d);
|
||||
|
||||
ir_swizzle *swizzle(operand a, int swizzle, int components);
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue