John Kessenich | dadf945 | 2013-02-11 00:54:44 +0000 | [diff] [blame] | 1 | #version 130 |
| 2 | |
| 3 | float gu[]; |
| 4 | float g4[4]; |
| 5 | float g5[5]; |
| 6 | |
| 7 | uniform int a; |
| 8 | |
| 9 | float[4] foo(float a[5]) |
| 10 | { |
| 11 | return float[](a[0], a[1], a[2], a[3]); |
| 12 | } |
| 13 | |
| 14 | void bar(float[5]) {} |
| 15 | |
| 16 | void main() |
| 17 | { |
| 18 | { |
| 19 | float gu[2]; // okay, new scope |
| 20 | |
| 21 | gu[2] = 4.0; // ERROR, overflow |
| 22 | } |
| 23 | |
| 24 | gu[2] = 4.0; // okay |
| 25 | |
| 26 | gu[3] = 3.0; |
| 27 | gu[a] = 5.0; // ERROR |
| 28 | |
| 29 | g4 = foo(g5); |
| 30 | g5 = g4; // ERROR |
| 31 | gu = g4; // ERROR |
| 32 | |
| 33 | foo(gu); // ERROR |
| 34 | bar(g5); |
| 35 | |
| 36 | if (float[4](1.0, 2.0, 3.0, 4.0) == g4) |
| 37 | gu[0] = 2.0; |
| 38 | |
| 39 | float u[]; |
| 40 | u[2] = 3.0; // okay |
| 41 | float u[5]; |
| 42 | u[5] = 5.0; // ERROR |
| 43 | foo(u); // okay |
| 44 | |
| 45 | gl_FragData[1000] = vec4(1.0); // ERROR |
| 46 | gl_FragData[-1] = vec4(1.0); // ERROR |
| 47 | gl_FragData[3] = vec4(1.0); |
| 48 | |
| 49 | const int ca[] = int[](3, 2); |
| 50 | int sum = ca[0]; |
| 51 | sum += ca[1]; |
| 52 | sum += ca[2]; // ERROR |
| 53 | |
| 54 | const int ca3[3] = int[](3, 2); // ERROR |
| 55 | int ica[] = int[](3, 2); |
| 56 | int ica3[3] = int[](3, 2); // ERROR |
John Kessenich | ef84d10 | 2013-06-25 21:53:59 +0000 | [diff] [blame] | 57 | ica[3.1] = 3; // ERROR |
| 58 | ica[u[1]] = 4; // ERROR |
John Kessenich | dadf945 | 2013-02-11 00:54:44 +0000 | [diff] [blame] | 59 | } |
John Kessenich | 34bd4fb | 2013-12-04 16:43:00 +0000 | [diff] [blame] | 60 | |
| 61 | int[] foo213234(); // ERROR |
| 62 | int foo234234(float[]); // ERROR |
| 63 | int foo234235(vec2[] v); // ERROR |
John Kessenich | cf0206c | 2014-04-14 15:46:40 +0000 | [diff] [blame] | 64 | |
| 65 | vec3 guns[]; |
| 66 | float f = guns[7]; |
| 67 | |
| 68 | void foo() |
| 69 | { |
| 70 | int uns[]; |
| 71 | uns[3] = 40; |
| 72 | uns[1] = 30; |
| 73 | guns[2] = vec3(2.4); |
| 74 | |
| 75 | float unsf[]; |
| 76 | bar(unsf); // ERROR |
| 77 | } |
| 78 | |
| 79 | float[] foo2() // ERROR |
| 80 | { |
| 81 | float f[]; |
| 82 | return f; |
| 83 | float g[9]; |
| 84 | return g; // ERROR |
| 85 | } |
| 86 | |
| 87 | float gUnusedUnsized[]; |
| 88 | |
| 89 | void foo3() |
| 90 | { |
| 91 | float resize1[]; |
| 92 | resize1[2] = 4.0; |
| 93 | resize1.length(); // ERROR |
| 94 | float resize1[3]; |
| 95 | resize1.length(); |
| 96 | |
| 97 | float resize2[]; |
| 98 | resize2[5] = 4.0; |
| 99 | float resize2[5]; // should be ERROR, but is not |
| 100 | resize2.length(); |
| 101 | resize2[5] = 4.0; // ERROR |
| 102 | } |
John Kessenich | efb8461 | 2015-07-21 14:35:39 -0600 | [diff] [blame] | 103 | |
John Kessenich | 12a3833 | 2015-07-22 11:44:59 -0600 | [diff] [blame] | 104 | int[] i = int[](); // ERROR, need constructor arguments |
| 105 | float emptyA[];
|
| 106 | float b = vec4(emptyA); // ERROR, array can't be a constructor argument
|