diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 9ee67914..12c955f2 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -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; diff --git a/tests/hlsl/ternary.shader_test b/tests/hlsl/ternary.shader_test index 3b62513d..5f38d896 100644 --- a/tests/hlsl/ternary.shader_test +++ b/tests/hlsl/ternary.shader_test @@ -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)