mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Forbid mismatched argument types in ternaries.
This commit is contained in:
parent
275901557c
commit
9ad48f16ea
Notes:
Alexandre Julliard
2024-01-18 23:20:41 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/571
@ -4120,6 +4120,22 @@ static bool add_ternary(struct hlsl_ctx *ctx, struct hlsl_block *block,
|
|||||||
common_type = hlsl_get_numeric_type(ctx, cond_type->class,
|
common_type = hlsl_get_numeric_type(ctx, cond_type->class,
|
||||||
common_type->base_type, cond_type->dimx, cond_type->dimy);
|
common_type->base_type, cond_type->dimx, cond_type->dimy);
|
||||||
}
|
}
|
||||||
|
else if (cond_type->dimx != common_type->dimx || cond_type->dimy != common_type->dimy)
|
||||||
|
{
|
||||||
|
/* This condition looks wrong but is correct.
|
||||||
|
* floatN is compatible with float1xN, but not with floatNx1. */
|
||||||
|
|
||||||
|
struct vkd3d_string_buffer *cond_string, *value_string;
|
||||||
|
|
||||||
|
cond_string = hlsl_type_to_string(ctx, cond_type);
|
||||||
|
value_string = hlsl_type_to_string(ctx, common_type);
|
||||||
|
if (cond_string && value_string)
|
||||||
|
hlsl_error(ctx, &first->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
|
||||||
|
"Ternary condition type '%s' is not compatible with value type '%s'.",
|
||||||
|
cond_string->buffer, value_string->buffer);
|
||||||
|
hlsl_release_string_buffer(ctx, cond_string);
|
||||||
|
hlsl_release_string_buffer(ctx, value_string);
|
||||||
|
}
|
||||||
|
|
||||||
if (!(first = add_implicit_conversion(ctx, block, first, common_type, &first->loc)))
|
if (!(first = add_implicit_conversion(ctx, block, first, common_type, &first->loc)))
|
||||||
return false;
|
return false;
|
||||||
|
@ -124,7 +124,7 @@ probe all rgba (5.0, 6.0, 7.0, 1.0)
|
|||||||
% * the result operands are scalar;
|
% * the result operands are scalar;
|
||||||
% * one is a typeN and the other is a type1xN
|
% * one is a typeN and the other is a type1xN
|
||||||
|
|
||||||
[pixel shader fail todo]
|
[pixel shader fail]
|
||||||
|
|
||||||
uniform float4 cond;
|
uniform float4 cond;
|
||||||
uniform float2x2 a, b;
|
uniform float2x2 a, b;
|
||||||
@ -135,7 +135,7 @@ float4 main() : sv_target
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[pixel shader fail todo]
|
[pixel shader fail]
|
||||||
|
|
||||||
uniform float2x2 cond;
|
uniform float2x2 cond;
|
||||||
uniform float4 a, b;
|
uniform float4 a, b;
|
||||||
@ -162,7 +162,7 @@ draw quad
|
|||||||
probe all rgba (1.0, 6.0, 7.0, 4.0)
|
probe all rgba (1.0, 6.0, 7.0, 4.0)
|
||||||
|
|
||||||
|
|
||||||
[pixel shader fail todo]
|
[pixel shader fail]
|
||||||
|
|
||||||
uniform float3 cond;
|
uniform float3 cond;
|
||||||
uniform float4 a, b;
|
uniform float4 a, b;
|
||||||
@ -174,7 +174,7 @@ float4 main() : sv_target
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[pixel shader fail todo]
|
[pixel shader fail]
|
||||||
|
|
||||||
uniform float4 cond;
|
uniform float4 cond;
|
||||||
uniform float4x1 a, b;
|
uniform float4x1 a, b;
|
||||||
|
Loading…
Reference in New Issue
Block a user