Merge pull request #2891 from dneto0/hlsl-namespace
[platform/upstream/glslang.git] / Test / cppNest.vert
1 #version 110
2
3 #define ON
4
5 float sum = 0.0;
6
7 void main()
8 {
9
10 #ifdef ON
11 //yes
12 sum += 1.0;
13
14     #ifdef OFF
15     //no
16     sum += 20.0;
17     #endif
18
19     #if defined(ON)
20     //yes
21     sum += 300.0;
22     #endif
23
24 #endif
25
26
27 #if defined(OFF)
28 //no
29 sum += 4000.0;
30
31 #if !defined(ON)
32 //no
33 sum += 50000.0;
34 #endif
35
36     //no
37     sum += 0.1;
38     #ifdef ON
39         //no
40         sum += 0.2;
41     #endif
42
43     //no
44     sum += 0.01;
45     #ifdef ON
46         //no
47         sum += 0.02;
48     #else
49         //no
50         sum += 0.03;
51     #endif
52
53 //no
54     sum + 0.3;
55
56 #endif
57
58
59 #if !defined(OFF)
60 //yes
61 sum += 600000.0;
62
63     #if defined(ON) && !defined(OFF)
64     //yes
65     sum += 80000000.0;
66
67         #if defined(OFF) || defined(ON)
68         //yes
69         sum += 900000000.0;
70
71             #if defined(ON) && defined(OFF)
72                 //no
73                 sum += 0.7;
74             #elif !defined(OFF)
75                 //yes
76                 sum += 7000000.0;
77             #endif
78
79         #endif
80
81     #endif
82
83 #endif
84
85 // sum should be 987600301.0
86     gl_Position = vec4(sum);
87 }
88
89 #define  A 1
90 #define  C 0
91 #define  E 0
92 #define  F 1
93 #if A
94     #if C
95         #if E
96             int selected4 = 1;
97         #elif F
98             int selected4 = 2;
99         #else
100             int selected4 = 3;
101         #endif
102     #endif
103     int selected4 = 4;
104 #endif
105
106 #define  ZA 1
107 #define  ZC 1
108 #define  ZE 0
109 #define  ZF 1
110 #if ZA
111     #if ZC
112         #if ZE
113             int selected2 = 1;
114         #elif ZF
115             int selected2 = 2;
116         #else
117             int selected2 = 3;
118         #endif
119     #endif
120 #endif
121
122 #define  AZA 1
123 #define  AZC 1
124 #define  AZE 0
125 #define  AZF 0
126 #if AZA
127     #if AZC
128         #if AZE
129             int selected3 = 1;
130         #elif AZF
131             int selected3 = 2;
132         #else
133             int selected3 = 3;
134         #endif
135     #endif
136 #endif
137
138 // ERROR cases...
139
140 #if 0
141 int;
142 #else
143 int;
144 #elif 1
145 int;
146 #endif
147
148 #if 0
149 int;
150 #else
151 int;
152 #else
153 int;
154 #endif
155
156 #if 0
157     #if 0
158     int;
159     #else
160     int;
161     #elif 1
162     int;
163     #endif
164
165     #if 0
166     int;
167     #else
168     int;
169     #else
170     int;
171     #endif
172 #endif
173
174 #define FUNC(a,b)               a+b
175 void foo985(){  FUNC( (((2))), ((3),4)); }
176 // needs to be last test in file
177 void foo987(){  FUNC(((); }  // ERROR, EOF in argument