From: Francisco Casas fcasas@codeweavers.com
Signed-off-by: Francisco Casas fcasas@codeweavers.com Signed-off-by: Zebediah Figura zfigura@codeweavers.com Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v4: Tweak style a tiny bit.
Makefile.am | 2 + tests/hlsl-initializer-struct.shader_test | 84 +++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 tests/hlsl-initializer-struct.shader_test
diff --git a/Makefile.am b/Makefile.am index 84c7b859..8cedf208 100644 --- a/Makefile.am +++ b/Makefile.am @@ -70,6 +70,7 @@ vkd3d_shader_tests = \ tests/hlsl-gather.shader_test \ tests/hlsl-initializer-local-array.shader_test \ tests/hlsl-initializer-static-array.shader_test \ + tests/hlsl-initializer-struct.shader_test \ tests/hlsl-intrinsic-override.shader_test \ tests/hlsl-invalid.shader_test \ tests/hlsl-majority-pragma.shader_test \ @@ -299,6 +300,7 @@ XFAIL_TESTS = \ tests/hlsl-array-dimension.shader_test \ tests/hlsl-initializer-local-array.shader_test \ tests/hlsl-initializer-static-array.shader_test \ + tests/hlsl-initializer-struct.shader_test \ tests/hlsl-bool-cast.shader_test \ tests/hlsl-duplicate-modifiers.shader_test \ tests/hlsl-for.shader_test \ diff --git a/tests/hlsl-initializer-struct.shader_test b/tests/hlsl-initializer-struct.shader_test new file mode 100644 index 00000000..f4028b5b --- /dev/null +++ b/tests/hlsl-initializer-struct.shader_test @@ -0,0 +1,84 @@ +[pixel shader] +struct stu +{ + int3 aaa; + float3 bbb; + int2 ccc; + float4 ddd; + int eee; +}; + +float4 main() : sv_target +{ + struct stu val = + { + 11, 12, 13, + 21, 22, 23, + 31, 32, + 41, 42, 43, 44, + 51 + }; + return val.ddd; +} + +[test] +draw quad +probe all rgba (41, 42, 43, 44) + + +[pixel shader] +struct stu +{ + int3 aaa; + float3 bbb[2]; + int2 ccc; + float4 ddd[3][2]; + int eee; +}; + +float4 main() : sv_target +{ + struct stu val = + { + 11, 12, 13, + 211, 212, 213, 221, 222, 223, + 31, 32, + 4111, 4112, 4113, 4114, 4121, 4122, 4123, 4124, + 4211, 4212, 4213, 4214, 4221, 4222, 4223, 4224, + 4311, 4312, 4313, 4314, 4321, 4322, 4323, 4324, + 51 + }; + return val.ddd[2][0]; +} + +[test] +draw quad +probe all rgba (4311, 4312, 4313, 4314) + + +[pixel shader] +struct stu +{ + int3 aaa; + struct + { + float4 foo; + int2 bar; + } bbb[3]; +}; + +float4 main() : sv_target +{ + struct stu val = + { + 1, 2, 3, + 11, 12, 13, 14, 15, 16, + 21, 22, 23, 24, 25, 26, + 31, 32, 33, 34, 35, 36 + }; + return val.bbb[1].foo; +} + +[test] +draw quad +probe all rgba (21, 22, 23, 24)
From: Francisco Casas fcasas@codeweavers.com
Signed-off-by: Francisco Casas fcasas@codeweavers.com Signed-off-by: Zebediah Figura zfigura@codeweavers.com Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v3: Rebase, tweak style, rename test file.
Makefile.am | 2 + ...-initializer-invalid-arg-count.shader_test | 107 ++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 tests/hlsl-initializer-invalid-arg-count.shader_test
diff --git a/Makefile.am b/Makefile.am index 8cedf208..7358faa3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -68,6 +68,7 @@ vkd3d_shader_tests = \ tests/hlsl-function-overload.shader_test \ tests/hlsl-gather-offset.shader_test \ tests/hlsl-gather.shader_test \ + tests/hlsl-initializer-invalid-arg-count.shader_test \ tests/hlsl-initializer-local-array.shader_test \ tests/hlsl-initializer-static-array.shader_test \ tests/hlsl-initializer-struct.shader_test \ @@ -298,6 +299,7 @@ XFAIL_TESTS = \ tests/cast-to-int.shader_test \ tests/cast-to-uint.shader_test \ tests/hlsl-array-dimension.shader_test \ + tests/hlsl-initializer-invalid-arg-count.shader_test \ tests/hlsl-initializer-local-array.shader_test \ tests/hlsl-initializer-static-array.shader_test \ tests/hlsl-initializer-struct.shader_test \ diff --git a/tests/hlsl-initializer-invalid-arg-count.shader_test b/tests/hlsl-initializer-invalid-arg-count.shader_test new file mode 100644 index 00000000..4332fbe8 --- /dev/null +++ b/tests/hlsl-initializer-invalid-arg-count.shader_test @@ -0,0 +1,107 @@ +[pixel shader] +float4 main() : sv_target +{ + float4 color[2][3] = + { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 + }; + return color[1][1]; +} + +[test] +draw quad +probe all rgba (17, 18, 19, 20) + + +[pixel shader fail] +float4 main() : sv_target +{ + float4 color[2][3] = + { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 + }; + return color[1][1]; +} + +[pixel shader fail] +float4 main() : sv_target +{ + float4 color[2][3] = + { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 + }; + return color[1][1]; +} + + +[pixel shader] +struct stu +{ + struct + { + int bar; + float4 foo; + } bbb[2]; + int2 aaa; +}; + +float4 main() : sv_target +{ + struct stu val = + { + 11, 12, 13, 14, 25, + 21, 22, 23, 24, 25, + 31, 32, + }; + return val.bbb[1].foo; +} + +[test] +draw quad +probe all rgba (22, 23, 24, 25) + + +[pixel shader fail] +struct stu +{ + struct + { + int bar; + float4 foo; + } bbb[2]; + int2 aaa; +}; + +float4 main() : sv_target +{ + struct stu val = + { + 11, 12, 13, 14, 25, + 21, 22, 23, 24, 25, + 31, 32, 33, + }; + return val.bbb[1].foo; +} + + +[pixel shader fail] +struct stu +{ + struct + { + int bar; + float4 foo; + } bbb[2]; + int2 aaa; +}; + +float4 main() : sv_target +{ + struct stu val = + { + 11, 12, 13, 14, 25, + 21, 22, 23, 24, 25, + 31, + }; + return val.bbb[1].foo; +}
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
From: Francisco Casas fcasas@codeweavers.com
Signed-off-by: Francisco Casas fcasas@codeweavers.com Signed-off-by: Zebediah Figura zfigura@codeweavers.com Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v3: Rebase.
Makefile.am | 2 ++ tests/hlsl-initializer-numeric.shader_test | 35 ++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 tests/hlsl-initializer-numeric.shader_test
diff --git a/Makefile.am b/Makefile.am index 7358faa3..b045cec9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -70,6 +70,7 @@ vkd3d_shader_tests = \ tests/hlsl-gather.shader_test \ tests/hlsl-initializer-invalid-arg-count.shader_test \ tests/hlsl-initializer-local-array.shader_test \ + tests/hlsl-initializer-numeric.shader_test \ tests/hlsl-initializer-static-array.shader_test \ tests/hlsl-initializer-struct.shader_test \ tests/hlsl-intrinsic-override.shader_test \ @@ -301,6 +302,7 @@ XFAIL_TESTS = \ tests/hlsl-array-dimension.shader_test \ tests/hlsl-initializer-invalid-arg-count.shader_test \ tests/hlsl-initializer-local-array.shader_test \ + tests/hlsl-initializer-numeric.shader_test \ tests/hlsl-initializer-static-array.shader_test \ tests/hlsl-initializer-struct.shader_test \ tests/hlsl-bool-cast.shader_test \ diff --git a/tests/hlsl-initializer-numeric.shader_test b/tests/hlsl-initializer-numeric.shader_test new file mode 100644 index 00000000..2fce3909 --- /dev/null +++ b/tests/hlsl-initializer-numeric.shader_test @@ -0,0 +1,35 @@ +[pixel shader] +float4 main() : sv_target +{ + int4 aa = {1, 2, 3, 4}; + return aa; +} + +[test] +draw quad +probe all rgba (1.0, 2.0, 3.0, 4.0) 4 + + +[pixel shader] +float4 main() : sv_target +{ + float4 aa = {1, 2, 3, 4}; + return aa; +} + +[test] +draw quad +probe all rgba (1.0, 2.0, 3.0, 4.0) 4 + + +[pixel shader] +float4 main() : sv_target +{ + float3 aa = {1, 2, 3}; + float4 bb = {aa.x, aa.y, aa.z, 4.0}; + return bb; +} + +[test] +draw quad +probe all rgba (1.0, 2.0, 3.0, 4.0) 4
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
From: Francisco Casas fcasas@codeweavers.com
Signed-off-by: Francisco Casas fcasas@codeweavers.com Signed-off-by: Zebediah Figura zfigura@codeweavers.com Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v3: Rebase, tweak style, keep test lists in order.
Makefile.am | 2 + tests/hlsl-initializer-nested.shader_test | 56 +++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 tests/hlsl-initializer-nested.shader_test
diff --git a/Makefile.am b/Makefile.am index b045cec9..92c49c35 100644 --- a/Makefile.am +++ b/Makefile.am @@ -70,6 +70,7 @@ vkd3d_shader_tests = \ tests/hlsl-gather.shader_test \ tests/hlsl-initializer-invalid-arg-count.shader_test \ tests/hlsl-initializer-local-array.shader_test \ + tests/hlsl-initializer-nested.shader_test \ tests/hlsl-initializer-numeric.shader_test \ tests/hlsl-initializer-static-array.shader_test \ tests/hlsl-initializer-struct.shader_test \ @@ -302,6 +303,7 @@ XFAIL_TESTS = \ tests/hlsl-array-dimension.shader_test \ tests/hlsl-initializer-invalid-arg-count.shader_test \ tests/hlsl-initializer-local-array.shader_test \ + tests/hlsl-initializer-nested.shader_test \ tests/hlsl-initializer-numeric.shader_test \ tests/hlsl-initializer-static-array.shader_test \ tests/hlsl-initializer-struct.shader_test \ diff --git a/tests/hlsl-initializer-nested.shader_test b/tests/hlsl-initializer-nested.shader_test new file mode 100644 index 00000000..b00259c9 --- /dev/null +++ b/tests/hlsl-initializer-nested.shader_test @@ -0,0 +1,56 @@ +[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)
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
From: Francisco Casas fcasas@codeweavers.com
Signed-off-by: Francisco Casas fcasas@codeweavers.com Signed-off-by: Zebediah Figura zfigura@codeweavers.com Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v3: Tweak style.
Makefile.am | 2 ++ ...numeric-constructor-truncation.shader_test | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 tests/hlsl-numeric-constructor-truncation.shader_test
diff --git a/Makefile.am b/Makefile.am index 92c49c35..8a32802a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -79,6 +79,7 @@ vkd3d_shader_tests = \ tests/hlsl-majority-pragma.shader_test \ tests/hlsl-majority-typedef.shader_test \ tests/hlsl-nested-arrays.shader_test \ + tests/hlsl-numeric-constructor-truncation.shader_test \ tests/hlsl-numeric-types.shader_test \ tests/hlsl-return-implicit-conversion.shader_test \ tests/hlsl-return-void.shader_test \ @@ -316,6 +317,7 @@ XFAIL_TESTS = \ tests/hlsl-majority-pragma.shader_test \ tests/hlsl-majority-typedef.shader_test \ tests/hlsl-nested-arrays.shader_test \ + tests/hlsl-numeric-constructor-truncation.shader_test \ tests/hlsl-numeric-types.shader_test \ tests/hlsl-return-implicit-conversion.shader_test \ tests/hlsl-return-void.shader_test \ diff --git a/tests/hlsl-numeric-constructor-truncation.shader_test b/tests/hlsl-numeric-constructor-truncation.shader_test new file mode 100644 index 00000000..f18b34d6 --- /dev/null +++ b/tests/hlsl-numeric-constructor-truncation.shader_test @@ -0,0 +1,33 @@ +[pixel shader] +float4 main() : sv_target +{ + float3 x = float4(71, 72, 73, 74); + return float4(x, 75); +} + +[test] +draw quad +probe all rgba (71.0, 72.0, 73.0, 75.0) + + +[pixel shader] +struct stu +{ + float aa; + float2 bb; + float cc; +}; + +float4 main() : sv_target +{ + struct stu foo; + foo.cc = 5; + foo.bb = float3(2, 3, 4); // It shall not overflow to cc; + foo.aa = 1; + + return float4(foo); +} + +[test] +draw quad +probe all rgba (1.0, 2.0, 3.0, 5.0)
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
From: Francisco Casas fcasas@codeweavers.com
Signed-off-by: Francisco Casas fcasas@codeweavers.com Signed-off-by: Zebediah Figura zfigura@codeweavers.com Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v3: Tweak formatting.
Makefile.am | 1 + ...lsl-single-numeric-initializer.shader_test | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/hlsl-single-numeric-initializer.shader_test
diff --git a/Makefile.am b/Makefile.am index 8a32802a..e52c4c1a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -84,6 +84,7 @@ vkd3d_shader_tests = \ tests/hlsl-return-implicit-conversion.shader_test \ tests/hlsl-return-void.shader_test \ tests/hlsl-shape.shader_test \ + tests/hlsl-single-numeric-initializer.shader_test \ tests/hlsl-state-block-syntax.shader_test \ tests/hlsl-static-initializer.shader_test \ tests/hlsl-storage-qualifiers.shader_test \ diff --git a/tests/hlsl-single-numeric-initializer.shader_test b/tests/hlsl-single-numeric-initializer.shader_test new file mode 100644 index 00000000..3b348d6f --- /dev/null +++ b/tests/hlsl-single-numeric-initializer.shader_test @@ -0,0 +1,26 @@ +[pixel shader] +float4 main() : sv_target +{ + float4 aa = 7; + return aa; +} + +[test] +draw quad +probe all rgba (7.0, 7.0, 7.0, 7.0) + + +[pixel shader] +float4 main() : sv_target +{ + float4 bb; + float3 aa = 7; + + bb.xyz = aa; + bb.w = 8.0; + return bb; +} + +[test] +draw quad +probe all rgba (7.0, 7.0, 7.0, 8.0)
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
From: Francisco Casas fcasas@codeweavers.com
Signed-off-by: Francisco Casas fcasas@codeweavers.com Signed-off-by: Zebediah Figura zfigura@codeweavers.com Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v3: Rebase, tweak formatting.
Makefile.am | 2 + tests/hlsl-initializer-flatten.shader_test | 73 ++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 tests/hlsl-initializer-flatten.shader_test
diff --git a/Makefile.am b/Makefile.am index e52c4c1a..7a7bd6a7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -68,6 +68,7 @@ vkd3d_shader_tests = \ tests/hlsl-function-overload.shader_test \ tests/hlsl-gather-offset.shader_test \ tests/hlsl-gather.shader_test \ + tests/hlsl-initializer-flatten.shader_test \ tests/hlsl-initializer-invalid-arg-count.shader_test \ tests/hlsl-initializer-local-array.shader_test \ tests/hlsl-initializer-nested.shader_test \ @@ -303,6 +304,7 @@ XFAIL_TESTS = \ tests/cast-to-int.shader_test \ tests/cast-to-uint.shader_test \ tests/hlsl-array-dimension.shader_test \ + tests/hlsl-initializer-flatten.shader_test \ tests/hlsl-initializer-invalid-arg-count.shader_test \ tests/hlsl-initializer-local-array.shader_test \ tests/hlsl-initializer-nested.shader_test \ diff --git a/tests/hlsl-initializer-flatten.shader_test b/tests/hlsl-initializer-flatten.shader_test new file mode 100644 index 00000000..6b35c6b7 --- /dev/null +++ b/tests/hlsl-initializer-flatten.shader_test @@ -0,0 +1,73 @@ +[pixel shader] +float4 main() : sv_target +{ + float4 aa = {1, float2(2, 3), 4}; + return aa; +} + +[test] +draw quad +probe all rgba (1, 2, 3, 4) + + +[pixel shader] +struct stu +{ + int3 aa; + float4 bb; +}; + +float4 main() : sv_target +{ + struct stu foo = {1, 2, float2(3, 4), int3(5, 6, 7)}; + return foo.bb; +} + +[test] +draw quad +probe all rgba (4, 5, 6, 7) + + +[pixel shader] +float4 main() : sv_target +{ + int4 aa = {10, 20, 30, 40}; + float4 foo[3] = {1, aa, aa, 2, 3, 4}; + return foo[1]; +} + +[test] +draw quad +probe all rgba (40, 10, 20, 30) + + +[pixel shader] +struct stu +{ + float aa; + int bb; +}; + +float4 main() : sv_target +{ + struct stu foo = {2.0, 3}; + float4 f = {1.0, foo, 4.0}; + return f; +} + +[test] +draw quad +probe all rgba (1.0, 2.0, 3.0, 4.0) + + +[pixel shader] +float4 main() : sv_target +{ + int arr[3] = {2, 3, 4}; + float4 f = {1.0, arr}; + return f; +} + +[test] +draw quad +probe all rgba (1.0, 2.0, 3.0, 4.0)
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com