vkd3d-shader/hlsl: Fix the conditions to discard default values.

Otherwise default_values for strings are lost.

Thanks to Nikolay Sivov for pointing this out.
This commit is contained in:
Francisco Casas 2024-10-01 11:36:56 -03:00 committed by Henri Verbeet
parent b7314e2438
commit 0b989c9f37
Notes: Henri Verbeet 2024-10-07 17:52:25 +02:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1137
2 changed files with 12 additions and 12 deletions

View File

@ -2366,9 +2366,9 @@ static void initialize_var_components(struct hlsl_ctx *ctx, struct hlsl_block *i
{ {
struct hlsl_default_value default_value = {0}; struct hlsl_default_value default_value = {0};
if (hlsl_is_numeric_type(dst_comp_type))
{
if (src->type == HLSL_IR_COMPILE || src->type == HLSL_IR_SAMPLER_STATE) if (src->type == HLSL_IR_COMPILE || src->type == HLSL_IR_SAMPLER_STATE)
{
if (hlsl_is_numeric_type(dst_comp_type))
{ {
/* Default values are discarded if they contain an object /* Default values are discarded if they contain an object
* literal expression for a numeric component. */ * literal expression for a numeric component. */
@ -2381,6 +2381,7 @@ static void initialize_var_components(struct hlsl_ctx *ctx, struct hlsl_block *i
dst->default_values = NULL; dst->default_values = NULL;
} }
} }
}
else else
{ {
if (!hlsl_clone_block(ctx, &block, instrs)) if (!hlsl_clone_block(ctx, &block, instrs))
@ -2393,7 +2394,6 @@ static void initialize_var_components(struct hlsl_ctx *ctx, struct hlsl_block *i
hlsl_block_cleanup(&block); hlsl_block_cleanup(&block);
} }
} }
}
else else
{ {
if (src->type == HLSL_IR_SAMPLER_STATE) if (src->type == HLSL_IR_SAMPLER_STATE)

View File

@ -86,7 +86,7 @@ technique10
// Without initializer // Without initializer
technique10 < int a; > {} technique10 < int a; > {}
[effect fail todo] [effect fail]
// Only numeric types and strings are allowed // Only numeric types and strings are allowed
technique10 < DepthStencilState ds = { 0 }; > {} technique10 < DepthStencilState ds = { 0 }; > {}