mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Move the numeric type check to add_constructor().
This commit is contained in:
parent
97eac342d3
commit
c553c45f00
Notes:
Henri Verbeet
2024-12-03 14:56:02 +01:00
Approved-by: Francisco Casas (@fcasas) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1233
@ -5445,6 +5445,17 @@ static struct hlsl_block *add_constructor(struct hlsl_ctx *ctx, struct hlsl_type
|
||||
struct hlsl_ir_load *load;
|
||||
struct hlsl_ir_var *var;
|
||||
|
||||
if (!hlsl_is_numeric_type(type))
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
|
||||
if ((string = hlsl_type_to_string(ctx, type)))
|
||||
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
|
||||
"Constructor data type %s is not numeric.", string->buffer);
|
||||
hlsl_release_string_buffer(ctx, string);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(var = hlsl_new_synthetic_var(ctx, "constructor", type, loc)))
|
||||
return NULL;
|
||||
|
||||
@ -9169,18 +9180,6 @@ postfix_expr:
|
||||
hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER,
|
||||
"Modifiers are not allowed on constructors.");
|
||||
|
||||
if (!hlsl_is_numeric_type($2))
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
|
||||
if ((string = hlsl_type_to_string(ctx, $2)))
|
||||
hlsl_error(ctx, &@2, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
|
||||
"Constructor data type %s is not numeric.", string->buffer);
|
||||
hlsl_release_string_buffer(ctx, string);
|
||||
free_parse_initializer(&$4);
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
if (!($$ = add_constructor(ctx, $2, &$4, &@2)))
|
||||
{
|
||||
free_parse_initializer(&$4);
|
||||
|
Loading…
x
Reference in New Issue
Block a user