mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Parse the clamp() intrinsic.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
committed by
Alexandre Julliard
parent
99674ab60f
commit
d035f3c2ff
@@ -1555,6 +1555,20 @@ static const struct hlsl_ir_function_decl *find_function_call(struct hlsl_ctx *c
|
||||
return args.decl;
|
||||
}
|
||||
|
||||
static bool intrinsic_clamp(struct hlsl_ctx *ctx,
|
||||
const struct parse_initializer *params, struct vkd3d_shader_location loc)
|
||||
{
|
||||
struct hlsl_ir_node *args[3] = {params->args[0], params->args[1]};
|
||||
struct hlsl_ir_expr *max;
|
||||
|
||||
if (!(max = add_expr(ctx, params->instrs, HLSL_OP2_MAX, args, &loc)))
|
||||
return false;
|
||||
|
||||
args[0] = &max->node;
|
||||
args[1] = params->args[2];
|
||||
return !!add_expr(ctx, params->instrs, HLSL_OP2_MIN, args, &loc);
|
||||
}
|
||||
|
||||
static bool intrinsic_max(struct hlsl_ctx *ctx,
|
||||
const struct parse_initializer *params, struct vkd3d_shader_location loc)
|
||||
{
|
||||
@@ -1572,6 +1586,7 @@ static const struct intrinsic_function
|
||||
}
|
||||
intrinsic_functions[] =
|
||||
{
|
||||
{"clamp", 3, true, intrinsic_clamp},
|
||||
{"max", 2, true, intrinsic_max},
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user