John Kessenich | 564842b | 2013-01-10 18:20:47 +0000 | [diff] [blame] | 1 | #version 120 |
| 2 | |
John Kessenich | 1c80995 | 2013-01-31 22:55:53 +0000 | [diff] [blame] | 3 | float lowp; |
| 4 | float mediump; |
| 5 | float highp; |
John Kessenich | 564842b | 2013-01-10 18:20:47 +0000 | [diff] [blame] | 6 | |
John Kessenich | 1c80995 | 2013-01-31 22:55:53 +0000 | [diff] [blame] | 7 | float precision; |
John Kessenich | 564842b | 2013-01-10 18:20:47 +0000 | [diff] [blame] | 8 | |
| 9 | in vec4 i; |
| 10 | out vec4 o; |
| 11 | |
John Kessenich | ca8899c | 2013-03-01 21:53:13 +0000 | [diff] [blame] | 12 | uniform sampler2D s2D; |
| 13 | centroid varying vec2 centTexCoord; |
| 14 | |
John Kessenich | 71fca67 | 2013-02-12 08:02:20 +0000 | [diff] [blame] | 15 | uniform mat4x2 m; |
| 16 | |
John Kessenich | 4b67103 | 2013-02-28 20:49:41 +0000 | [diff] [blame] | 17 | struct s { |
| 18 | float f; |
| 19 | }; |
| 20 | |
John Kessenich | 564842b | 2013-01-10 18:20:47 +0000 | [diff] [blame] | 21 | void main() |
| 22 | { |
John Kessenich | 71fca67 | 2013-02-12 08:02:20 +0000 | [diff] [blame] | 23 | mat2x3 m23 = mat2x3(m); |
John Kessenich | 4b67103 | 2013-02-28 20:49:41 +0000 | [diff] [blame] | 24 | |
| 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; |
| 39 | v3 = iv3 / 2.0; |
| 40 | 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 Kessenich | ca8899c | 2013-03-01 21:53:13 +0000 | [diff] [blame] | 64 | |
| 65 | gl_FragColor = texture2D(s2D, centTexCoord); |
John Kessenich | c2ff770 | 2013-04-25 16:44:03 +0000 | [diff] [blame] | 66 | |
| 67 | float flat; |
| 68 | float smooth; |
| 69 | float noperspective; |
| 70 | float uvec2; |
| 71 | float uvec3; |
| 72 | float uvec4; |
| 73 | //packed; // ERROR, reserved word |
John Kessenich | 8d00fd0 | 2013-05-28 07:29:58 +0000 | [diff] [blame] | 74 | |
| 75 | { |
| 76 | mat4 m; |
| 77 | vec4 v; |
| 78 | bool b; |
| 79 | gl_FragColor += b ? v : m; // ERROR, types don't match around ":" |
| 80 | } |
John Kessenich | ef84d10 | 2013-06-25 21:53:59 +0000 | [diff] [blame] | 81 | |
| 82 | gl_FragColor.xr; // ERROR, swizzlers not from same field space |
John Kessenich | d46b31f | 2013-08-27 03:59:04 +0000 | [diff] [blame] | 83 | gl_FragColor.xyxyx.xy; // ERROR, cannot make a vec5, even temporarily |
John Kessenich | ef84d10 | 2013-06-25 21:53:59 +0000 | [diff] [blame] | 84 | centTexCoord.z; // ERROR, swizzler out of range |
| 85 | (a,b) = true; // ERROR, not an l-value |
John Kessenich | 564842b | 2013-01-10 18:20:47 +0000 | [diff] [blame] | 86 | } |
John Kessenich | c2ff770 | 2013-04-25 16:44:03 +0000 | [diff] [blame] | 87 | |
| 88 | float imageBuffer; |
| 89 | float uimage2DRect; |
John Kessenich | ef84d10 | 2013-06-25 21:53:59 +0000 | [diff] [blame] | 90 | |
| 91 | int main() {} // ERROR |
| 92 | void main(int a) {} // ERROR |
| 93 | |
| 94 | const int a; // ERROR |
| 95 | |
| 96 | int foo(in float a); |
| 97 | int foo(out float a) // ERROR |
| 98 | { |
| 99 | return 3.2; // ERROR |
| 100 | foo(a); // ERROR |
| 101 | } |
John Kessenich | 252b619 | 2013-08-08 16:22:54 +0000 | [diff] [blame] | 102 | |
| 103 | bool gen(vec3 v) |
| 104 | { |
| 105 | if (abs(v[0]) < 1e-4 && abs(v[1]) < 1e-4) |
| 106 | return true; |
John Kessenich | d46b31f | 2013-08-27 03:59:04 +0000 | [diff] [blame] | 107 | } |
| 108 | |
| 109 | void v1() |
| 110 | { |
| 111 | } |
| 112 | |
| 113 | void v2() |
| 114 | { |
| 115 | return v1(); // ERROR, no expression allowed, even though void |
| 116 | } |
John Kessenich | 5f753e0 | 2013-09-08 21:04:46 +0000 | [diff] [blame^] | 117 | |
| 118 | void atest() |
| 119 | { |
| 120 | vec4 v = gl_TexCoord[1]; |
| 121 | v += gl_TexCoord[3]; |
| 122 | } |
| 123 | |
| 124 | varying vec4 gl_TexCoord[6]; // okay, assigning a size |
| 125 | varying vec4 gl_TexCoord[5]; // ERROR, changing size |