vkd3d-shader/hlsl: Store the initializer location in struct parse_initializer.

This commit is contained in:
Elizabeth Figura 2024-08-29 12:48:23 -05:00 committed by Henri Verbeet
parent 44ea7b5e12
commit d8892a4ca2
Notes: Henri Verbeet 2024-10-17 17:39:41 +02:00
Approved-by: Francisco Casas (@fcasas)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1185

View File

@ -40,6 +40,7 @@ struct parse_initializer
unsigned int args_count; unsigned int args_count;
struct hlsl_block *instrs; struct hlsl_block *instrs;
bool braces; bool braces;
struct vkd3d_shader_location loc;
}; };
struct parse_parameter struct parse_parameter
@ -2883,7 +2884,7 @@ static struct hlsl_block *initialize_vars(struct hlsl_ctx *ctx, struct list *var
size = initializer_size(&v->initializer); size = initializer_size(&v->initializer);
if (component_count != size) if (component_count != size)
{ {
hlsl_error(ctx, &v->loc, VKD3D_SHADER_ERROR_HLSL_WRONG_PARAMETER_COUNT, hlsl_error(ctx, &v->initializer.loc, VKD3D_SHADER_ERROR_HLSL_WRONG_PARAMETER_COUNT,
"Expected %u components in initializer, but got %u.", component_count, size); "Expected %u components in initializer, but got %u.", component_count, size);
free_parse_variable_def(v); free_parse_variable_def(v);
continue; continue;
@ -8324,6 +8325,7 @@ complex_initializer:
$$.args[0] = node_from_block($1); $$.args[0] = node_from_block($1);
$$.instrs = $1; $$.instrs = $1;
$$.braces = false; $$.braces = false;
$$.loc = @$;
} }
| '{' complex_initializer_list '}' | '{' complex_initializer_list '}'
{ {
@ -8355,6 +8357,7 @@ complex_initializer_list:
$$.args[$$.args_count++] = $3.args[i]; $$.args[$$.args_count++] = $3.args[i];
hlsl_block_add_block($$.instrs, $3.instrs); hlsl_block_add_block($$.instrs, $3.instrs);
free_parse_initializer(&$3); free_parse_initializer(&$3);
$$.loc = @$;
} }
initializer_expr: initializer_expr:
@ -8372,6 +8375,7 @@ initializer_expr_list:
$$.args[0] = node_from_block($1); $$.args[0] = node_from_block($1);
$$.instrs = $1; $$.instrs = $1;
$$.braces = false; $$.braces = false;
$$.loc = @$;
} }
| initializer_expr_list ',' initializer_expr | initializer_expr_list ',' initializer_expr
{ {
@ -8690,6 +8694,7 @@ func_arguments:
if (!($$.instrs = make_empty_block(ctx))) if (!($$.instrs = make_empty_block(ctx)))
YYABORT; YYABORT;
$$.braces = false; $$.braces = false;
$$.loc = @$;
} }
| initializer_expr_list | initializer_expr_list