Merge pull request #2908 from Biswa96/cmake-spirv-remap
[platform/upstream/glslang.git] / Test / hlsl.array.implicit-size.frag
1
2 // array size from initializer
3 static float g_array [ ] = { 1, 2, 3, 4, 5 };
4
5 // Unused: array size from initializer
6 static float g_array_unused [ ] = { 1, 2, 3, 4, 5, 6, 7 };
7
8 // Test initializer sizing for arrayed structs
9 static struct mystruct {
10     int i;
11     float f;
12 } g_mystruct[] = {
13     { 1, 2.0 },
14     { 3, 4.0 },
15 };
16
17 struct PS_OUTPUT { float4 color : SV_Target0; };
18
19 // INVALID: implicit size requires an initializer expression.
20 // uniform float bad[];
21
22 // INVALID: function parameters cannot be implicitly sized
23 // void BadFunction(int a[]) { }
24
25 void main(out PS_OUTPUT ps_output)
26 {
27     // local array sized from initializers
28     float l_array[] = { 1, 2, 3 };
29     int idx;
30
31     ps_output.color = g_array[0] + g_array[4] + l_array[1] + g_mystruct[0].f + g_array[idx];
32 }