vkd3d-shader/hlsl: Forbid objects in ternary conditions.

This commit is contained in:
Zebediah Figura 2023-12-11 14:06:00 -06:00 committed by Alexandre Julliard
parent 38fdf24002
commit 2c8751478f
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
2 changed files with 11 additions and 1 deletions

View File

@ -4091,6 +4091,16 @@ static bool add_ternary(struct hlsl_ctx *ctx, struct hlsl_block *block,
struct hlsl_ir_node *args[HLSL_MAX_OPERANDS] = {0};
struct hlsl_type *common_type;
if (cond->data_type->class > HLSL_CLASS_LAST_NUMERIC)
{
struct vkd3d_string_buffer *string;
if ((string = hlsl_type_to_string(ctx, cond->data_type)))
hlsl_error(ctx, &cond->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
"Ternary condition type '%s' is not numeric.", string->buffer);
hlsl_release_string_buffer(ctx, string);
}
if (first->data_type->class <= HLSL_CLASS_LAST_NUMERIC
&& second->data_type->class <= HLSL_CLASS_LAST_NUMERIC)
{

View File

@ -353,7 +353,7 @@ float4 main() : sv_target
% Of course objects cannot be used as the condition.
[pixel shader fail todo]
[pixel shader fail]
Texture2D t;
float4 main() : sv_target