From a18ace731d3da2aaf88906c115ee3417fcbb4a72 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 10 Jul 2023 16:04:21 +0200 Subject: [PATCH] tests: Add a test for side effects of ternary operator. Signed-off-by: Nikolay Sivov --- tests/hlsl/ternary.shader_test | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/hlsl/ternary.shader_test b/tests/hlsl/ternary.shader_test index 1fc2f070..99fee241 100644 --- a/tests/hlsl/ternary.shader_test +++ b/tests/hlsl/ternary.shader_test @@ -31,3 +31,18 @@ float4 main() : sv_target uniform 0 float4 1.1 3.0 4.0 5.0 draw quad probe all rgba (1.1, 2.0, 0.0, 0.0) + +[pixel shader] +float4 f; + +float4 main() : sv_target +{ + float f1 = 0.1, f2 = 0.2, f3; + f3 = f.x ? (f1 = 0.5) + 0.2 : (f2 = 0.6); + return float4(f1, f2, f3, 0.0); +} + +[test] +uniform 0 float4 1.0 0.0 0.0 0.0 +draw quad +probe all rgba (0.5, 0.6, 0.7, 0.0)