mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Add a stub for the noise() intrinsic.
This function is used in tx_1_0 code, but is also supported in fx_2_0 and fx_4_0 expressions. Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
committed by
Henri Verbeet
parent
93e1a8c784
commit
f135f7fe07
Notes:
Henri Verbeet
2025-06-19 20:52:05 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1564
@@ -4294,6 +4294,28 @@ static bool intrinsic_mul(struct hlsl_ctx *ctx,
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool intrinsic_noise(struct hlsl_ctx *ctx,
|
||||
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
struct hlsl_type *type = params->args[0]->data_type, *ret_type;
|
||||
struct hlsl_ir_node *args[HLSL_MAX_OPERANDS] = {0};
|
||||
|
||||
type = params->args[0]->data_type;
|
||||
if (type->class == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
if ((string = hlsl_type_to_string(ctx, type)))
|
||||
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
|
||||
"Wrong argument type for noise(): expected vector or scalar, but got '%s'.", string->buffer);
|
||||
hlsl_release_string_buffer(ctx, string);
|
||||
}
|
||||
|
||||
args[0] = intrinsic_float_convert_arg(ctx, params, params->args[0], loc);
|
||||
ret_type = hlsl_get_scalar_type(ctx, args[0]->data_type->e.numeric.type);
|
||||
|
||||
return !!add_expr(ctx, params->instrs, HLSL_OP1_NOISE, args, ret_type, loc);
|
||||
}
|
||||
|
||||
static bool intrinsic_normalize(struct hlsl_ctx *ctx,
|
||||
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
@@ -5258,6 +5280,7 @@ intrinsic_functions[] =
|
||||
{"min", 2, true, intrinsic_min},
|
||||
{"modf", 2, true, intrinsic_modf},
|
||||
{"mul", 2, true, intrinsic_mul},
|
||||
{"noise", 1, true, intrinsic_noise},
|
||||
{"normalize", 1, true, intrinsic_normalize},
|
||||
{"pow", 2, true, intrinsic_pow},
|
||||
{"radians", 1, true, intrinsic_radians},
|
||||
|
Reference in New Issue
Block a user