From: Francisco Casas Subject: [PATCH vkd3d v2 5/8] tests: Test nested initializers. Message-Id: <20220120141016.67283-5-fcasas@codeweavers.com> Date: Thu, 20 Jan 2022 11:10:13 -0300 Signed-off-by: Francisco Casas --- Makefile.am | 2 + tests/hlsl-initializer-nested.shader_test | 54 +++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 tests/hlsl-initializer-nested.shader_test diff --git a/Makefile.am b/Makefile.am index ef32711c..2a6d54e4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -68,6 +68,7 @@ vkd3d_shader_tests = \ tests/hlsl-duplicate-modifiers.shader_test \ tests/hlsl-for.shader_test \ tests/hlsl-function-overload.shader_test \ + tests/hlsl-initializer-nested.shader_test \ tests/hlsl-initializer-invalid-n-args.shader_test \ tests/hlsl-initializer-local-array.shader_test \ tests/hlsl-initializer-numeric.shader_test \ @@ -294,6 +295,7 @@ XFAIL_TESTS = \ tests/cast-to-int.shader_test \ tests/cast-to-uint.shader_test \ tests/hlsl-array-dimension.shader_test \ + tests/hlsl-initializer-nested.shader_test \ tests/hlsl-initializer-invalid-n-args.shader_test \ tests/hlsl-initializer-local-array.shader_test \ tests/hlsl-initializer-numeric.shader_test \ diff --git a/tests/hlsl-initializer-nested.shader_test b/tests/hlsl-initializer-nested.shader_test new file mode 100644 index 00000000..b32ced40 --- /dev/null +++ b/tests/hlsl-initializer-nested.shader_test @@ -0,0 +1,54 @@ +[pixel shader] +float4 main() : sv_target +{ + float4 aaa = {1, {{{2, {3}}, 4}}}; + return aaa; +} + +[test] +draw quad +probe all rgba (1, 2, 3, 4) + + +[pixel shader] +float4 main() : sv_target +{ + float4 aaa[3] = { + 11, {{{12, {13}}, 14}, + 21, 22}, 23, {{24, + 31, {32, 33}, 34}}, + }; + return aaa[1]; +} + +[test] +draw quad +probe all rgba (21, 22, 23, 24) + + +[pixel shader] +struct stu1 +{ + float4 aaa; + float4 bbb; +}; + +struct stu2 +{ + int3 ccc; + stu1 ddd; +}; + +float4 main() : sv_target +{ + struct stu2 val = { + 11, {12, 13, + 21, {{{22}}}, 23}, {{24, + 31, 32}}, 33, 34, + }; + return val.ddd.aaa; +} + +[test] +draw quad +probe all rgba (21, 22, 23, 24) -- 2.25.1