mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Implement f16tof32 intrinsic.
This commit is contained in:
committed by
Henri Verbeet
parent
693e89c74e
commit
8c3a5e5458
Notes:
Henri Verbeet
2024-08-08 23:47:42 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/954
@@ -3070,6 +3070,19 @@ static bool elementwise_intrinsic_float_convert_args(struct hlsl_ctx *ctx,
|
||||
return convert_args(ctx, params, type, loc);
|
||||
}
|
||||
|
||||
static bool elementwise_intrinsic_uint_convert_args(struct hlsl_ctx *ctx,
|
||||
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
struct hlsl_type *type;
|
||||
|
||||
if (!(type = elementwise_intrinsic_get_common_type(ctx, params, loc)))
|
||||
return false;
|
||||
|
||||
type = hlsl_get_numeric_type(ctx, type->class, HLSL_TYPE_UINT, type->dimx, type->dimy);
|
||||
|
||||
return convert_args(ctx, params, type, loc);
|
||||
}
|
||||
|
||||
static bool intrinsic_abs(struct hlsl_ctx *ctx,
|
||||
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
@@ -3775,6 +3788,21 @@ static bool intrinsic_faceforward(struct hlsl_ctx *ctx,
|
||||
return add_user_call(ctx, func, params, loc);
|
||||
}
|
||||
|
||||
static bool intrinsic_f16tof32(struct hlsl_ctx *ctx,
|
||||
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
struct hlsl_ir_node *operands[HLSL_MAX_OPERANDS] = {0};
|
||||
struct hlsl_type *type;
|
||||
|
||||
if (!elementwise_intrinsic_uint_convert_args(ctx, params, loc))
|
||||
return false;
|
||||
|
||||
type = convert_numeric_type(ctx, params->args[0]->data_type, HLSL_TYPE_FLOAT);
|
||||
|
||||
operands[0] = params->args[0];
|
||||
return add_expr(ctx, params->instrs, HLSL_OP1_F16TOF32, operands, type, loc);
|
||||
}
|
||||
|
||||
static bool intrinsic_floor(struct hlsl_ctx *ctx,
|
||||
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
@@ -4875,6 +4903,7 @@ intrinsic_functions[] =
|
||||
{"dot", 2, true, intrinsic_dot},
|
||||
{"exp", 1, true, intrinsic_exp},
|
||||
{"exp2", 1, true, intrinsic_exp2},
|
||||
{"f16tof32", 1, true, intrinsic_f16tof32},
|
||||
{"faceforward", 3, true, intrinsic_faceforward},
|
||||
{"floor", 1, true, intrinsic_floor},
|
||||
{"fmod", 2, true, intrinsic_fmod},
|
||||
|
||||
Reference in New Issue
Block a user