mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Parse lerp() intrinsic.
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
committed by
Alexandre Julliard
parent
bb32ffad18
commit
7682da58a8
@@ -2109,6 +2109,26 @@ static bool intrinsic_ldexp(struct hlsl_ctx *ctx,
|
|||||||
return !!add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, params->args[0], arg, loc);
|
return !!add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, params->args[0], arg, loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool intrinsic_lerp(struct hlsl_ctx *ctx,
|
||||||
|
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||||
|
{
|
||||||
|
struct hlsl_ir_node *arg, *neg, *add, *mul;
|
||||||
|
|
||||||
|
if (!(arg = intrinsic_float_convert_arg(ctx, params, params->args[0], loc)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!(neg = add_unary_arithmetic_expr(ctx, params->instrs, HLSL_OP1_NEG, arg, loc)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!(add = add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_ADD, params->args[1], neg, loc)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!(mul = add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, params->args[2], add, loc)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return !!add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_ADD, arg, mul, loc);
|
||||||
|
}
|
||||||
|
|
||||||
static bool intrinsic_max(struct hlsl_ctx *ctx,
|
static bool intrinsic_max(struct hlsl_ctx *ctx,
|
||||||
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||||
{
|
{
|
||||||
@@ -2298,6 +2318,7 @@ intrinsic_functions[] =
|
|||||||
{"dot", 2, true, intrinsic_dot},
|
{"dot", 2, true, intrinsic_dot},
|
||||||
{"floor", 1, true, intrinsic_floor},
|
{"floor", 1, true, intrinsic_floor},
|
||||||
{"ldexp", 2, true, intrinsic_ldexp},
|
{"ldexp", 2, true, intrinsic_ldexp},
|
||||||
|
{"lerp", 3, true, intrinsic_lerp},
|
||||||
{"max", 2, true, intrinsic_max},
|
{"max", 2, true, intrinsic_max},
|
||||||
{"min", 2, true, intrinsic_min},
|
{"min", 2, true, intrinsic_min},
|
||||||
{"mul", 2, true, intrinsic_mul},
|
{"mul", 2, true, intrinsic_mul},
|
||||||
|
@@ -12,7 +12,7 @@ float4 main() : SV_TARGET
|
|||||||
uniform 0 float4 2.0 3.0 4.0 5.0
|
uniform 0 float4 2.0 3.0 4.0 5.0
|
||||||
uniform 4 float4 0.0 -10.0 10.0 100.0
|
uniform 4 float4 0.0 -10.0 10.0 100.0
|
||||||
uniform 8 float4 0.0 1.0 -1.0 0.75
|
uniform 8 float4 0.0 1.0 -1.0 0.75
|
||||||
todo draw quad
|
draw quad
|
||||||
probe all rgba (2.0, -10.0, -2.0, 76.25)
|
probe all rgba (2.0, -10.0, -2.0, 76.25)
|
||||||
|
|
||||||
[require]
|
[require]
|
||||||
@@ -32,5 +32,5 @@ float4 main() : SV_TARGET
|
|||||||
uniform 0 int4 2 3 4 0
|
uniform 0 int4 2 3 4 0
|
||||||
uniform 4 int4 0 -10 10 1000000
|
uniform 4 int4 0 -10 10 1000000
|
||||||
uniform 8 int4 0 1 -1 1000000
|
uniform 8 int4 0 1 -1 1000000
|
||||||
todo draw quad
|
draw quad
|
||||||
probe all rgba (2.0, -10.0, -2.0, 1e12)
|
probe all rgba (2.0, -10.0, -2.0, 1e12)
|
||||||
|
Reference in New Issue
Block a user