mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-09-13 09:16:14 -07:00
vkd3d-shader/hlsl: Do not crash on initialization of a redefined variable.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
0a344bd3c9
commit
4d2ce385a7
Notes:
Henri Verbeet
2024-07-08 18:55:00 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/918
@ -2629,7 +2629,14 @@ static struct hlsl_block *initialize_vars(struct hlsl_ctx *ctx, struct list *var
|
||||
|
||||
if (is_default_values_initializer)
|
||||
{
|
||||
assert(!var->default_values);
|
||||
/* Default values might have been allocated already for another variable of the same name,
|
||||
in the same scope. */
|
||||
if (var->default_values)
|
||||
{
|
||||
free_parse_variable_def(v);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(var->default_values = hlsl_calloc(ctx, component_count, sizeof(*var->default_values))))
|
||||
{
|
||||
free_parse_variable_def(v);
|
||||
|
@ -320,3 +320,12 @@ float4 main() : sv_target
|
||||
{
|
||||
return u.y;
|
||||
}
|
||||
|
||||
[pixel shader fail]
|
||||
float a = 1;
|
||||
int a = 2;
|
||||
|
||||
float4 main() : sv_target
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user