Merge pull request #2976 from jeremy-lunarg/hayes-fix-2975
[platform/upstream/glslang.git] / Test / hlsl.init2.frag
1
2 void Test1()
3 {
4     struct mystruct { float2 a; };
5     mystruct test1 = {
6         { 1, 2, },          // test trailing commas in list
7     };
8
9     mystruct test2 = {
10         float2(3, 4),
11     };
12
13     // mystruct test3 = {
14     //     { { 5, 6, } },   // TODO: test unneeded levels
15     // };
16
17     float test4 = { 7, } ;   // test scalar initialization
18
19     struct mystruct2 { float a; float b; float c; };
20     mystruct2 test5 = { {8,}, {9,}, {10}, };
21     const mystruct2 constTest5 = { {8,}, {9,}, {10}, };
22     constTest5.c;
23
24     const float step = 1.f;\r
25     float n = 0;\r
26     const float3 a[8] = {\r
27             normalize(float3(1, 1, 1)) * (n += step),\r
28             normalize(float3(-1, -1, -1)) * (n += step),\r
29             normalize(float3(-1, -1, 1)) * (n += step),\r
30             normalize(float3(-1, 1, -1)) * (n += step),\r
31             normalize(float3(-1, 1, 1)) * (n += step),\r
32             normalize(float3(1, -1, -1)) * (n += step),\r
33             normalize(float3(1, -1, 1)) * (n += step),\r
34             normalize(float3(1, 1, -1)) * (n += step) };
35
36     const struct one { float3 a; } oneNonConst = { normalize(float3(-1, 1, 1)) * (n += step) };
37     const struct two { float3 a;
38                        float3 b; } twoNonConst = { normalize(float3(-1, 1, 1)) * (n += step),
39                                                    normalize(float3(-1, 1, 1)) * (n += step) };
40 }
41
42 struct PS_OUTPUT { float4 color : SV_Target0; };
43
44 PS_OUTPUT main()
45 {
46     Test1();
47
48     PS_OUTPUT ps_output;
49     ps_output.color = 1.0;
50     return ps_output;
51 }