blob: ac70c20a6ae8d009d87c25453c8df3eb2789dd93 [file] [log] [blame]
John Kessenich564842b2013-01-10 18:20:47 +00001#version 120
2
John Kessenich1c809952013-01-31 22:55:53 +00003float lowp;
4float mediump;
5float highp;
John Kessenich564842b2013-01-10 18:20:47 +00006
John Kessenich1c809952013-01-31 22:55:53 +00007float precision;
John Kessenich564842b2013-01-10 18:20:47 +00008
9in vec4 i;
10out vec4 o;
11
John Kessenichca8899c2013-03-01 21:53:13 +000012uniform sampler2D s2D;
13centroid varying vec2 centTexCoord;
14
John Kessenich71fca672013-02-12 08:02:20 +000015uniform mat4x2 m;
16
John Kessenich4b671032013-02-28 20:49:41 +000017struct s {
18 float f;
19};
20
John Kessenich564842b2013-01-10 18:20:47 +000021void main()
22{
John Kessenich71fca672013-02-12 08:02:20 +000023 mat2x3 m23 = mat2x3(m);
John Kessenich4b671032013-02-28 20:49:41 +000024
25 int a;
26 bool b;
27 s sv = s(a);
28 float[2] ia = float[2](3, i.y);
29 float f1 = 1;
30 float f = a;
31 f = a;
32 ivec3 iv3;
33 vec3 v3 = iv3;
34 f = f + a;
35 f = a - f;
36 f += a;
37 f = a - f;
38 v3 *= iv3;
John Kessenich69aa9c12013-11-12 03:31:24 +000039 v3 = iv3 / 2.0f;
John Kessenich4b671032013-02-28 20:49:41 +000040 v3 = 3.0 * iv3;
41 v3 = 2 * v3;
42 v3 = v3 - 2;
43 if (f < a ||
44 a <= f ||
45 f > a ||
46 f >= a ||
47 a == f ||
48 f != a);
49 f = b ? a : f;
50 f = b ? f : a;
51 f = b ? a : a;
52 s news = sv;
53
54 i.xy + i.xyz; // ERROR
55 m * i.xyz; // ERROR
56 m + i; // ERROR
57 int aoeu = 1.0; // ERROR
58 f = b; // ERROR
59 f = a + b; // ERROR
60 f = b * a; // ERROR
61 b = a; // ERROR
62 b = b + f; // ERROR
63 f |= b; // ERROR
John Kessenichca8899c2013-03-01 21:53:13 +000064
65 gl_FragColor = texture2D(s2D, centTexCoord);
John Kessenichc2ff7702013-04-25 16:44:03 +000066
67 float flat;
68 float smooth;
69 float noperspective;
70 float uvec2;
71 float uvec3;
72 float uvec4;
73 //packed; // ERROR, reserved word
John Kessenich8d00fd02013-05-28 07:29:58 +000074
75 {
76 mat4 m;
77 vec4 v;
78 bool b;
79 gl_FragColor += b ? v : m; // ERROR, types don't match around ":"
80 }
John Kessenichef84d102013-06-25 21:53:59 +000081
82 gl_FragColor.xr; // ERROR, swizzlers not from same field space
John Kessenichd46b31f2013-08-27 03:59:04 +000083 gl_FragColor.xyxyx.xy; // ERROR, cannot make a vec5, even temporarily
John Kessenichef84d102013-06-25 21:53:59 +000084 centTexCoord.z; // ERROR, swizzler out of range
85 (a,b) = true; // ERROR, not an l-value
John Kessenich564842b2013-01-10 18:20:47 +000086}
John Kessenichc2ff7702013-04-25 16:44:03 +000087
88float imageBuffer;
89float uimage2DRect;
John Kessenichef84d102013-06-25 21:53:59 +000090
91int main() {} // ERROR
92void main(int a) {} // ERROR
93
94const int a; // ERROR
95
96int foo(in float a);
97int foo(out float a) // ERROR
98{
99 return 3.2; // ERROR
100 foo(a); // ERROR
101}
John Kessenich252b6192013-08-08 16:22:54 +0000102
103bool gen(vec3 v)
104{
John Kessenich69aa9c12013-11-12 03:31:24 +0000105 if (abs(v[0]) < 1e-4F && abs(v[1]) < 1e-4)
John Kessenich252b6192013-08-08 16:22:54 +0000106 return true;
John Kessenichd46b31f2013-08-27 03:59:04 +0000107}
108
109void v1()
110{
111}
112
113void v2()
114{
115 return v1(); // ERROR, no expression allowed, even though void
116}
John Kessenich5f753e02013-09-08 21:04:46 +0000117
118void atest()
119{
120 vec4 v = gl_TexCoord[1];
121 v += gl_TexCoord[3];
122}
123
124varying vec4 gl_TexCoord[6]; // okay, assigning a size
125varying vec4 gl_TexCoord[5]; // ERROR, changing size