John Kessenich | ca8899c | 2013-03-01 21:53:13 +0000 | [diff] [blame] | 1 | #version 120 |
| 2 | |
John Kessenich | e369bfc | 2013-06-26 05:54:40 +0000 | [diff] [blame] | 3 | in vec4 i; // ERROR |
| 4 | out vec4 o; // ERROR |
John Kessenich | ca8899c | 2013-03-01 21:53:13 +0000 | [diff] [blame] | 5 | |
| 6 | attribute vec2 attv2; |
| 7 | attribute vec4 attv4; |
| 8 | uniform sampler2D s2D; |
| 9 | invariant varying vec2 centTexCoord; |
| 10 | invariant gl_Position; |
John Kessenich | e369bfc | 2013-06-26 05:54:40 +0000 | [diff] [blame] | 11 | centroid gl_Position; // ERROR |
| 12 | centroid centroid foo; // ERROR |
John Kessenich | 60d9f7a | 2013-06-19 20:44:17 +0000 | [diff] [blame] | 13 | invariant gl_Position, gl_PointSize; |
John Kessenich | ca8899c | 2013-03-01 21:53:13 +0000 | [diff] [blame] | 14 | |
| 15 | void main() |
| 16 | { |
| 17 | centTexCoord = attv2; |
| 18 | gl_Position = attv4; |
John Kessenich | 3252b18 | 2013-03-04 23:50:08 +0000 | [diff] [blame] | 19 | |
John Kessenich | e7c59c1 | 2013-10-16 22:28:35 +0000 | [diff] [blame] | 20 | gl_ClipVertex = attv4; |
| 21 | gl_ClipDistance[1] = 0.2; // ERROR |
| 22 | |
John Kessenich | 3252b18 | 2013-03-04 23:50:08 +0000 | [diff] [blame] | 23 | vec3[12] a; |
| 24 | vec4[a.length()] b; |
| 25 | gl_Position = b[b.length()-1]; |
| 26 | |
| 27 | float f[]; |
John Kessenich | e369bfc | 2013-06-26 05:54:40 +0000 | [diff] [blame] | 28 | 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 Kessenich | 60d9f7a | 2013-06-19 20:44:17 +0000 | [diff] [blame] | 42 | |
| 43 | gl_PointSize = 3.8; |
John Kessenich | ca8899c | 2013-03-01 21:53:13 +0000 | [diff] [blame] | 44 | } |
John Kessenich | 3252b18 | 2013-03-04 23:50:08 +0000 | [diff] [blame] | 45 | |
John Kessenich | e369bfc | 2013-06-26 05:54:40 +0000 | [diff] [blame] | 46 | uniform float initted = 3.4; // okay |
John Kessenich | 3252b18 | 2013-03-04 23:50:08 +0000 | [diff] [blame] | 47 | |
| 48 | const float concall = sin(0.3); |
John Kessenich | e369bfc | 2013-06-26 05:54:40 +0000 | [diff] [blame] | 49 | |
| 50 | int[2][3] foo( // ERROR |
| 51 | float[2][3] a, // ERROR |
| 52 | float[2] b[3], // ERROR |
| 53 | float c[2][3]); // ERROR |
John Kessenich | 0d22e31 | 2013-10-30 23:17:34 +0000 | [diff] [blame] | 54 | |
| 55 | int overloadA(in float f); |
| 56 | int overloadA(out float f); // ERROR, different qualifiers |
| 57 | float overloadA(float); // ERROR, different return value for same signature |
| 58 | float overloadA(out float f, int); |
| 59 | float overloadA(int i); |
| 60 | |
John Kessenich | 75694fd | 2014-03-16 23:03:07 +0000 | [diff] [blame] | 61 | void overloadB(float, const in float) { } |
John Kessenich | 0d22e31 | 2013-10-30 23:17:34 +0000 | [diff] [blame] | 62 | |
| 63 | vec2 overloadC(int, int); |
John Kessenich | 75694fd | 2014-03-16 23:03:07 +0000 | [diff] [blame] | 64 | vec2 overloadC(const in int, float); |
John Kessenich | 0d22e31 | 2013-10-30 23:17:34 +0000 | [diff] [blame] | 65 | vec2 overloadC(float, int); |
| 66 | vec2 overloadC(vec2, vec2); |
| 67 | |
| 68 | vec3 overloadD(int, float); |
John Kessenich | 75694fd | 2014-03-16 23:03:07 +0000 | [diff] [blame] | 69 | vec3 overloadD(float, in int); |
John Kessenich | 0d22e31 | 2013-10-30 23:17:34 +0000 | [diff] [blame] | 70 | |
| 71 | vec3 overloadE(float[2]); |
| 72 | vec3 overloadE(mat2 m); |
| 73 | vec3 overloadE(vec2 v); |
| 74 | |
John Kessenich | 83a6b1e | 2013-10-31 18:05:50 +0000 | [diff] [blame] | 75 | vec3 overloadF(int); |
| 76 | vec3 overloadF(float); |
| 77 | |
John Kessenich | 0d22e31 | 2013-10-30 23:17:34 +0000 | [diff] [blame] | 78 | void foo() |
| 79 | { |
| 80 | float f; |
| 81 | int i; |
| 82 | |
| 83 | overloadB(f, f); |
| 84 | overloadB(f, 2); |
| 85 | overloadB(1, i); |
| 86 | |
John Kessenich | 83a6b1e | 2013-10-31 18:05:50 +0000 | [diff] [blame] | 87 | overloadC(1); // ERROR |
John Kessenich | 0d22e31 | 2013-10-30 23:17:34 +0000 | [diff] [blame] | 88 | 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 Kessenich | 83a6b1e | 2013-10-31 18:05:50 +0000 | [diff] [blame] | 116 | |
| 117 | overloadF(1, 1); // ERROR |
| 118 | overloadF(1); |
John Kessenich | 0d22e31 | 2013-10-30 23:17:34 +0000 | [diff] [blame] | 119 | } |
John Kessenich | 5f15d42 | 2013-12-06 23:57:42 +0000 | [diff] [blame] | 120 | |
| 121 | varying vec4 gl_TexCoord[35]; // ERROR, size too big |
John Kessenich | 75694fd | 2014-03-16 23:03:07 +0000 | [diff] [blame] | 122 | |
| 123 | // tests for output conversions |
| 124 | void outFun(in float, out ivec2, in int, out float); |
| 125 | int outFunRet(in float, out int, const in int, out ivec4); |
| 126 | ivec2 outFunRet(in float, out ivec4, in int, out ivec4); |
| 127 | |
| 128 | void 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 Kessenich | f5dd2f5 | 2014-03-26 03:17:31 +0000 | [diff] [blame] | 139 | bool b = any(lessThan(v4, attv4)); // tests aggregate arg to unary built-in |
John Kessenich | 75694fd | 2014-03-16 23:03:07 +0000 | [diff] [blame] | 140 | } |