mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Forbid objects in ternary conditions.
This commit is contained in:
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
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user