vkd3d-shader/hlsl: Handle scalar values in ternaries.

This commit is contained in:
Zebediah Figura 2024-01-16 18:14:30 -06:00 committed by Alexandre Julliard
parent 11112798c8
commit 275901557c
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 9 additions and 4 deletions

View File

@ -4115,6 +4115,11 @@ static bool add_ternary(struct hlsl_ctx *ctx, struct hlsl_block *block,
if (!(cond = add_implicit_conversion(ctx, block, cond, cond_type, &cond->loc)))
return false;
}
else if (common_type->dimx == 1 && common_type->dimy == 1)
{
common_type = hlsl_get_numeric_type(ctx, cond_type->class,
common_type->base_type, cond_type->dimx, cond_type->dimy);
}
if (!(first = add_implicit_conversion(ctx, block, first, common_type, &first->loc)))
return false;

View File

@ -282,7 +282,7 @@ draw quad
probe all rgba (5.0, 6.0, 7.0, 8.0)
[pixel shader todo]
[pixel shader]
uniform float4 cond;
uniform float4 a, b;
@ -296,11 +296,11 @@ float4 main() : sv_target
uniform 0 float4 1.0 0.0 1.0 0.0
uniform 4 float4 1.0 2.0 3.0 4.0
uniform 8 float4 5.0 6.0 7.0 8.0
todo draw quad
draw quad
probe all rgba (1.0, 5.0, 1.0, 5.0)
[pixel shader todo]
[pixel shader]
// "scalar" can mean any 1-component numeric type.
static float4 cond = {1, 0, 0, 1};
@ -313,7 +313,7 @@ float4 main() : sv_target
}
[test]
todo draw quad
draw quad
probe all rgba (2.0, 3.0, 3.0, 2.0)