blob: d2765571e5bf0655200d69c4f2e360781c54b090 [file] [log] [blame]
John Kessenichca8899c2013-03-01 21:53:13 +00001#version 120
2
John Kesseniche369bfc2013-06-26 05:54:40 +00003in vec4 i; // ERROR
4out vec4 o; // ERROR
John Kessenichca8899c2013-03-01 21:53:13 +00005
6attribute vec2 attv2;
7attribute vec4 attv4;
8uniform sampler2D s2D;
9invariant varying vec2 centTexCoord;
10invariant gl_Position;
John Kesseniche369bfc2013-06-26 05:54:40 +000011centroid gl_Position; // ERROR
12centroid centroid foo; // ERROR
John Kessenich60d9f7a2013-06-19 20:44:17 +000013invariant gl_Position, gl_PointSize;
John Kessenichca8899c2013-03-01 21:53:13 +000014
15void main()
16{
17 centTexCoord = attv2;
18 gl_Position = attv4;
John Kessenich3252b182013-03-04 23:50:08 +000019
John Kesseniche7c59c12013-10-16 22:28:35 +000020 gl_ClipVertex = attv4;
21 gl_ClipDistance[1] = 0.2; // ERROR
22
John Kessenich3252b182013-03-04 23:50:08 +000023 vec3[12] a;
24 vec4[a.length()] b;
25 gl_Position = b[b.length()-1];
26
27 float f[];
John Kesseniche369bfc2013-06-26 05:54:40 +000028 int a1 = f.length(); // ERROR
29 float f[7];
30 int aa = f.length();
31 int a2 = f.length; // ERROR
32 int a3 = f.length(a); // ERROR
33 int a4 = f.flizbit; // ERROR
34 int a4 = f.flizbit(); // ERROR
35 float md[2][4]; // ERROR
36 float[2] md2[4]; // ERROR
37 float[2][4] md3; // ERROR
38 float md5, md6[2][3]; // ERROR
39 float[2] md4, md7[4]; // ERROR
40 float md9[2][3] = float[2][3](1, 2, 3, 4, 5, 6); // ERROR
41 float md10, md11[2][3] = float[2][3](1, 2, 3, 4, 5, 6); // ERROR
John Kessenich60d9f7a2013-06-19 20:44:17 +000042
43 gl_PointSize = 3.8;
John Kessenichca8899c2013-03-01 21:53:13 +000044}
John Kessenich3252b182013-03-04 23:50:08 +000045
John Kesseniche369bfc2013-06-26 05:54:40 +000046uniform float initted = 3.4; // okay
John Kessenich3252b182013-03-04 23:50:08 +000047
48const float concall = sin(0.3);
John Kesseniche369bfc2013-06-26 05:54:40 +000049
50int[2][3] foo( // ERROR
51 float[2][3] a, // ERROR
52 float[2] b[3], // ERROR
53 float c[2][3]); // ERROR
John Kessenich0d22e312013-10-30 23:17:34 +000054
55int overloadA(in float f);
56int overloadA(out float f); // ERROR, different qualifiers
57float overloadA(float); // ERROR, different return value for same signature
58float overloadA(out float f, int);
59float overloadA(int i);
60
John Kessenich75694fd2014-03-16 23:03:07 +000061void overloadB(float, const in float) { }
John Kessenich0d22e312013-10-30 23:17:34 +000062
63vec2 overloadC(int, int);
John Kessenich75694fd2014-03-16 23:03:07 +000064vec2 overloadC(const in int, float);
John Kessenich0d22e312013-10-30 23:17:34 +000065vec2 overloadC(float, int);
66vec2 overloadC(vec2, vec2);
67
68vec3 overloadD(int, float);
John Kessenich75694fd2014-03-16 23:03:07 +000069vec3 overloadD(float, in int);
John Kessenich0d22e312013-10-30 23:17:34 +000070
71vec3 overloadE(float[2]);
72vec3 overloadE(mat2 m);
73vec3 overloadE(vec2 v);
74
John Kessenich83a6b1e2013-10-31 18:05:50 +000075vec3 overloadF(int);
76vec3 overloadF(float);
77
John Kessenich0d22e312013-10-30 23:17:34 +000078void foo()
79{
80 float f;
81 int i;
82
83 overloadB(f, f);
84 overloadB(f, 2);
85 overloadB(1, i);
86
John Kessenich83a6b1e2013-10-31 18:05:50 +000087 overloadC(1); // ERROR
John Kessenich0d22e312013-10-30 23:17:34 +000088 overloadC(1, i);
89 overloadC(vec2(1), vec2(2));
90 overloadC(f, 3.0); // ERROR, no way
91 overloadC(ivec2(1), vec2(2));
92
93 overloadD(i, f);
94 overloadD(f, i);
95 overloadD(i, i); // ERROR, ambiguous
96
97 int overloadB; // hiding
98 overloadB(1, i); // ERROR
99
100 sin(1);
101 texture2D(s2D, ivec2(0));
102 clamp(attv4, 0, 1);
103 clamp(ivec4(attv4), 0, 1);
104
105 int a[2];
106 overloadC(a, 3); // ERROR
107 overloadE(a); // ERROR
108 overloadE(3.3); // ERROR
109 overloadE(vec2(3.3));
110 overloadE(mat2(0.5));
111 overloadE(ivec4(1)); // ERROR
112 overloadE(ivec2(1));
113
114 float b[2];
115 overloadE(b);
John Kessenich83a6b1e2013-10-31 18:05:50 +0000116
117 overloadF(1, 1); // ERROR
118 overloadF(1);
John Kessenich0d22e312013-10-30 23:17:34 +0000119}
John Kessenich5f15d422013-12-06 23:57:42 +0000120
121varying vec4 gl_TexCoord[35]; // ERROR, size too big
John Kessenich75694fd2014-03-16 23:03:07 +0000122
123// tests for output conversions
124void outFun(in float, out ivec2, in int, out float);
125int outFunRet(in float, out int, const in int, out ivec4);
126ivec2 outFunRet(in float, out ivec4, in int, out ivec4);
127
128void foo2()
129{
130 vec2 v2;
131 vec4 v4;
132 float f;
133 int i;
134
135 outFun(i, v2, i, f);
136 outFunRet(i, f, i, v4);
137 float ret = outFunRet(i, f, i, v4);
138 vec2 ret2 = outFunRet(i, v4, i, v4);
John Kessenichf5dd2f52014-03-26 03:17:31 +0000139 bool b = any(lessThan(v4, attv4)); // tests aggregate arg to unary built-in
John Kessenich75694fd2014-03-16 23:03:07 +0000140}
John Kessenichcf0206c2014-04-14 15:46:40 +0000141
John Kessenichba5685a2016-02-02 15:59:12 -0700142void noise()
143{
144 float f1 = noise1(1.0);
145 vec2 f2 = noise2(vec2(1.0));
146 vec3 f3 = noise3(vec3(1.0));
147 vec4 f4 = noise4(vec4(1.0));
148}
149
John Kessenichcf0206c2014-04-14 15:46:40 +0000150// version 130 features
151
152uniform int c;
153
154attribute ivec2 x;
155attribute vec2 v2a;
156attribute float c1D;
157attribute vec2 c2D;
158attribute vec3 c3D;
159
160uniform vec4 v4;
161
162void foo213()
163{
164 float f = 3;
165 switch (c) { // ERRORs...
166 case 1:
167 f = sin(f);
168 break;
169 case 2:
170 f = f * f;
171 default:
172 f = 3.0;
173 }
174
175 int i;
176 i << 3 | 0x8A >> 1 & 0xFF; // ERRORs...
177
178 vec3 modfOut, modfIn;
179 vec3 v11 = modf(modfIn, modfOut); // ERRORS...
180 float t = trunc(f);
181 vec2 v12 = round(v2a);
182 vec2 v13 = roundEven(v2a);
183 bvec2 b10 = isnan(v2a);
184 bvec4 b11 = isinf(v4);
185
186 sinh(c1D) + // ERRORS...
187 cosh(c1D) * tanh(c2D);
188 asinh(c4D) + acosh(c4D);
189 atanh(c3D);
190
191 int id = gl_VertexID; // ERROR
192 gl_ClipDistance[1] = 0.3; // ERROR
193}
194
John Kessenichf2cfe272016-07-19 15:13:47 -0600195int gl_ModelViewMatrix[] = 0;
196
John Kessenichcf0206c2014-04-14 15:46:40 +0000197// token pasting (ERRORS...)
198
199#define mac abc##def
200int mac;
201
202#define macr(A,B) A ## B
203int macr(qrs,tuv);