vkd3d-shader/hlsl: Parse ceil() function.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov
2023-10-17 23:04:08 +02:00
committed by Alexandre Julliard
parent e57bf3db0b
commit 4284b7c522
Notes: Alexandre Julliard 2023-11-08 23:02:33 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Francisco Casas (@fcasas)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/417
3 changed files with 14 additions and 0 deletions

View File

@@ -2562,6 +2562,7 @@ const char *debug_hlsl_expr_op(enum hlsl_ir_expr_op op)
[HLSL_OP1_ABS] = "abs", [HLSL_OP1_ABS] = "abs",
[HLSL_OP1_BIT_NOT] = "~", [HLSL_OP1_BIT_NOT] = "~",
[HLSL_OP1_CAST] = "cast", [HLSL_OP1_CAST] = "cast",
[HLSL_OP1_CEIL] = "ceil",
[HLSL_OP1_COS] = "cos", [HLSL_OP1_COS] = "cos",
[HLSL_OP1_COS_REDUCED] = "cos_reduced", [HLSL_OP1_COS_REDUCED] = "cos_reduced",
[HLSL_OP1_DSX] = "dsx", [HLSL_OP1_DSX] = "dsx",

View File

@@ -526,6 +526,7 @@ enum hlsl_ir_expr_op
HLSL_OP1_ABS, HLSL_OP1_ABS,
HLSL_OP1_BIT_NOT, HLSL_OP1_BIT_NOT,
HLSL_OP1_CAST, HLSL_OP1_CAST,
HLSL_OP1_CEIL,
HLSL_OP1_COS, HLSL_OP1_COS,
HLSL_OP1_COS_REDUCED, /* Reduced range [-pi, pi] */ HLSL_OP1_COS_REDUCED, /* Reduced range [-pi, pi] */
HLSL_OP1_DSX, HLSL_OP1_DSX,

View File

@@ -2749,6 +2749,17 @@ static bool intrinsic_asuint(struct hlsl_ctx *ctx,
return add_expr(ctx, params->instrs, HLSL_OP1_REINTERPRET, operands, data_type, loc); return add_expr(ctx, params->instrs, HLSL_OP1_REINTERPRET, operands, data_type, loc);
} }
static bool intrinsic_ceil(struct hlsl_ctx *ctx,
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
{
struct hlsl_ir_node *arg;
if (!(arg = intrinsic_float_convert_arg(ctx, params, params->args[0], loc)))
return false;
return !!add_unary_arithmetic_expr(ctx, params->instrs, HLSL_OP1_CEIL, arg, loc);
}
static bool intrinsic_clamp(struct hlsl_ctx *ctx, static bool intrinsic_clamp(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)
{ {
@@ -3817,6 +3828,7 @@ intrinsic_functions[] =
{"any", 1, true, intrinsic_any}, {"any", 1, true, intrinsic_any},
{"asfloat", 1, true, intrinsic_asfloat}, {"asfloat", 1, true, intrinsic_asfloat},
{"asuint", -1, true, intrinsic_asuint}, {"asuint", -1, true, intrinsic_asuint},
{"ceil", 1, true, intrinsic_ceil},
{"clamp", 3, true, intrinsic_clamp}, {"clamp", 3, true, intrinsic_clamp},
{"clip", 1, true, intrinsic_clip}, {"clip", 1, true, intrinsic_clip},
{"cos", 1, true, intrinsic_cos}, {"cos", 1, true, intrinsic_cos},