From: Francisco Casas fcasas@codeweavers.com
--- ...lsl-initializer-implicit-array.shader_test | 181 ++++++++++++++++++ 1 file changed, 181 insertions(+)
diff --git a/tests/hlsl-initializer-implicit-array.shader_test b/tests/hlsl-initializer-implicit-array.shader_test index d2b94da4..b2a08d4b 100644 --- a/tests/hlsl-initializer-implicit-array.shader_test +++ b/tests/hlsl-initializer-implicit-array.shader_test @@ -11,8 +11,189 @@ todo probe all rgba (50, 60, 70, 80)
[pixel shader fail] +// Incompatible number of arguments in implicit size array initializer float4 main() : SV_TARGET { float4 arr[] = {10, 20, 30, 40, 50, 60, 70}; return arr[0]; } + + +[pixel shader fail] +// Incompatible number of arguments in implicit size array initializer +float4 main() : SV_TARGET +{ + float4 arr[] = {10, 20, 30, 40, 50, 60, 70, 80, 90}; + return arr[0]; +} + + +[pixel shader] +float4 main() : sv_target +{ + float2 arr[][3] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; + return float4(arr[1][0], arr[1][1]); +} + +[test] +todo draw quad +todo probe all rgba (7.0, 8.0, 9.0, 10.0) + + +[pixel shader fail] +// Implicit size inner array +float4 main() : sv_target +{ + float2 arr[3][] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; + return float4(arr[1][0], arr[1][1]); +} + + +[pixel shader fail] +// Implicit size array without initializer +float4 main() : sv_target +{ + float4 arr[]; + arr[0] = float4(1, 2, 3, 4); + arr[1] = float4(5, 6, 7, 8); + return arr[0]; +} + + +[pixel shader fail] +// Implicit size array as struct member +struct foobar +{ + int a; + float4 arr[]; +}; + +float4 main() : sv_target +{ + struct foobar s; + + s.a = 20; + s.arr[0] = float4(1, 2, 3, 4); + s.arr[1] = float4(5, 6, 7, 8); + + return arr[0]; +} + + +[pixel shader fail] +// Implicit size array as function argument +float4 sum1st2nd(float4 arr[]) +{ + return arr[0] + arr[1]; +} +float4 main() : sv_target +{ + float4 arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; + return sum1st2nd(arr); +} + + +[pixel shader fail] +// Implicit size array as function return type +// Note: explicit size arrays are not allowed either. +float4[] merge(float4 a, float4 b) +{ + float4 ret[2]; + ret[0] = a; + ret[1] = b; + return ret; +} +float4 main() : sv_target +{ + float4 a = float4(1, 2, 3, 4); + float4 b = float4(5, 6, 7, 8); + return merge(a, b)[0]; +} + +[pixel shader fail] +// Implicit size array as a typedef +float4 main() : sv_target +{ + float2 arr1[4] = {1, 2, 3, 4, 5, 6, 7, 8}; + float4 arr2[2] = (float2 []) arr1; + return arr2[1]; +} + +[pixel shader fail] +// Implicit array of elements of size 0 +struct emp +{ +}; + +float4 main() : sv_target +{ + struct emp arr[] = {1, 2, 3, 4}; + + return float4(1, 2, 3, 4); +} + +[pixel shader fail] +// Implicit array of elements of size 0, without initializer +struct emp +{ +}; + +float4 main() : sv_target +{ + struct emp arr[]; + + return float4(1, 2, 3, 4); +} + + +[pixel shader fail] +// Implicit array with an initializer of size 0 +struct emp +{ +}; + +float4 main() : sv_target +{ + float4 arr[] = (struct emp) 42; + + return float4(1, 2, 3, 4); +} + + +[pixel shader fail] +// Implicit array of elements of size 0 with initializer of size 0 +struct emp +{ +}; + +float4 main() : sv_target +{ + struct emp arr[] = (struct emp) 42; +} + + +[pixel shader] +float4 main() : sv_target +{ + float4 arr1[2] = {1, 2, 3, 4, 5, 6, 7, 8}; + float4 arr2[] = arr1; + + return arr2[1]; +} + +[test] +todo draw quad +todo probe all rgba (5.0, 6.0, 7.0, 8.0) + + +[pixel shader fail] +// Implicit array of elements of size 0 with broadcast initialization +struct emp { +}; + +float4 main() : sv_target +{ + struct emp p[] = 42; + + return float4(1, 2, 3, 4); +}