1#version 120 2 3in vec4 i; // ERROR 4out vec4 o; // ERROR 5 6attribute vec2 attv2; 7attribute vec4 attv4; 8uniform sampler2D s2D; 9invariant varying vec2 centTexCoord; 10invariant gl_Position; 11centroid gl_Position; // ERROR 12centroid centroid foo; // ERROR 13invariant gl_Position, gl_PointSize; 14 15void main() 16{ 17 centTexCoord = attv2; 18 gl_Position = attv4; 19 20 gl_ClipVertex = attv4; 21 gl_ClipDistance[1] = 0.2; // ERROR 22 23 vec3[12] a; 24 vec4[a.length()] b; 25 gl_Position = b[b.length()-1]; 26 27 float f[]; 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 42 43 gl_PointSize = 3.8; 44} 45 46uniform float initted = 3.4; // okay 47 48const float concall = sin(0.3); 49 50int[2][3] foo( // ERROR 51 float[2][3] a, // ERROR 52 float[2] b[3], // ERROR 53 float c[2][3]); // ERROR 54 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 61void overloadB(float, const in float) { } 62 63vec2 overloadC(int, int); 64vec2 overloadC(const in int, float); 65vec2 overloadC(float, int); 66vec2 overloadC(vec2, vec2); 67 68vec3 overloadD(int, float); 69vec3 overloadD(float, in int); 70 71vec3 overloadE(float[2]); 72vec3 overloadE(mat2 m); 73vec3 overloadE(vec2 v); 74 75vec3 overloadF(int); 76vec3 overloadF(float); 77 78void foo() 79{ 80 float f; 81 int i; 82 83 overloadB(f, f); 84 overloadB(f, 2); 85 overloadB(1, i); 86 87 overloadC(1); // ERROR 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); 116 117 overloadF(1, 1); // ERROR 118 overloadF(1); 119} 120 121varying vec4 gl_TexCoord[35]; // ERROR, size too big 122 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); 139 bool b = any(lessThan(v4, attv4)); // tests aggregate arg to unary built-in 140} 141 142void 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 150// 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 195int gl_ModelViewMatrix[] = 0; 196 197// token pasting (ERRORS...) 198 199#define mac abc##def 200int mac; 201 202#define macr(A,B) A ## B 203int macr(qrs,tuv); 204 205layout(std140) uniform BlockName // ERROR 206{ 207 int test; 208}; 209 210#extension GL_ARB_uniform_buffer_object : enable 211 212layout(std140) uniform BlockName 213{ 214 int test; 215};