1#version 120 2 3float lowp; 4float mediump; 5float highp; 6 7float precision; 8 9in vec4 i; 10out vec4 o; 11 12uniform sampler2D s2D; 13centroid varying vec2 centTexCoord; 14 15uniform mat4x2 m; 16 17struct s { 18 float f; 19}; 20 21void main() 22{ 23 mat2x3 m23 = mat2x3(m); 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.0f; 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 64 65 gl_FragColor = texture2D(s2D, centTexCoord); 66 67 float flat; 68 float smooth; 69 float noperspective; 70 float uvec2; 71 float uvec3; 72 float uvec4; 73 //packed; // ERROR, reserved word 74 75 { 76 mat4 m; 77 vec4 v; 78 bool b; 79 gl_FragColor += b ? v : m; // ERROR, types don't match around ":" 80 } 81 82 gl_FragColor.xr; // ERROR, swizzlers not from same field space 83 gl_FragColor.xyxyx.xy; // ERROR, cannot make a vec5, even temporarily 84 centTexCoord.z; // ERROR, swizzler out of range 85 (a,b) = true; // ERROR, not an l-value 86} 87 88float imageBuffer; 89float uimage2DRect; 90 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} 102 103bool gen(vec3 v) 104{ 105 if (abs(v[0]) < 1e-4F && abs(v[1]) < 1e-4) 106 return true; 107} 108 109void v1() 110{ 111} 112 113void v2() 114{ 115 return v1(); // ERROR, no expression allowed, even though void 116} 117 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 126 127mat2x2 m22; 128mat2x3 m23; 129mat2x4 m24; 130 131mat3x2 m32; 132mat3x3 m33; 133mat3x4 m34; 134 135mat4x2 m42; 136mat4x3 m43; 137mat4x4 m44; 138 139void foo123() 140{ 141 mat2 r2 = matrixCompMult(m22, m22); 142 mat3 r3 = matrixCompMult(m33, m33); 143 mat4 r4 = matrixCompMult(m44, m44); 144 145 mat2x3 r23 = matrixCompMult(m23, m23); 146 mat2x4 r24 = matrixCompMult(m24, m24); 147 mat3x2 r32 = matrixCompMult(m32, m32); 148 mat3x4 r34 = matrixCompMult(m34, m34); 149 mat4x2 r42 = matrixCompMult(m42, m42); 150 mat4x3 r43 = matrixCompMult(m43, m43); 151 152 mat3x2 rfoo1 = matrixCompMult(m23, m32); // ERROR 153 mat3x4 rfoo2 = matrixCompMult(m34, m44); // ERROR 154} 155 156void matConst() 157{ 158 vec2 v2; 159 vec3 v3; 160 mat4 m4b1 = mat4(v2, v3); // ERROR, not enough 161 mat4 m4b2 = mat4(v2, v3, v3, v3, v3, v2, v2); // ERROR, too much 162 mat4 m4g = mat4(v2, v3, v3, v3, v3, v3); 163 mat4 m4 = mat4(v2, v3, v3, v3, v3, v2); 164 mat3 m3 = mat3(m4); 165 mat3 m3b1 = mat3(m4, v2); // ERROR, extra arg 166 mat3 m3b2 = mat3(m4, m4); // ERROR, extra arg 167 mat3x2 m32 = mat3x2(m4); 168 mat4 m4c = mat4(m32); 169 mat3 m3s = mat3(v2.x); 170 171 mat3 m3a1[2] = mat3[2](m3s, m3s); 172 mat3 m3a2[2] = mat3[2](m3s, m3s, m3s); // ERROR, too many args 173} 174 175uniform sampler3D s3D; 176uniform sampler1D s1D; 177uniform sampler2DShadow s2DS; 178 179void foo2323() 180{ 181 vec4 v; 182 vec2 v2; 183 float f; 184 v = texture2DLod(s2D, v2, f); // ERROR 185 v = texture3DProjLod(s3D, v, f); // ERROR 186 v = texture1DProjLod(s1D, v, f); // ERROR 187 v = shadow2DProjLod(s2DS, v, f); // ERROR 188 189 v = texture1DGradARB(s1D, f, f, f); // ERROR 190 v = texture2DProjGradARB(s2D, v, v2, v2); // ERROR 191 v = shadow2DProjGradARB(s2DS, v, v2, v2); // ERROR 192} 193 194#extension GL_ARB_shader_texture_lod : require 195 196void foo2324() 197{ 198 vec4 v; 199 vec2 v2; 200 float f; 201 v = texture2DLod(s2D, v2, f); 202 v = texture3DProjLod(s3D, v, f); 203 v = texture1DProjLod(s1D, v, f); 204 v = shadow2DProjLod(s2DS, v, f); 205 206 v = texture1DGradARB(s1D, f, f, f); 207 v = texture2DProjGradARB(s2D, v, v2, v2); 208 v = shadow2DProjGradARB(s2DS, v, v2, v2); 209 v = shadow2DRectProjGradARB(s2DS, v, v2, v2); // ERROR 210} 211 212uniform sampler2DRect s2DRbad; // ERROR 213 214void foo121111() 215{ 216 vec2 v2; 217 vec4 v = texture2DRect(s2DRbad, v2); 218} 219 220#extension GL_ARB_texture_rectangle : enable 221 222uniform sampler2DRect s2DR; 223uniform sampler2DRectShadow s2DRS; 224 225void foo12111() 226{ 227 vec2 v2; 228 vec3 v3; 229 vec4 v4; 230 vec4 v; 231 v = texture2DRect(s2DR, v2); 232 v = texture2DRectProj(s2DR, v3); 233 v = texture2DRectProj(s2DR, v4); 234 v = shadow2DRect(s2DRS, v3); 235 v = shadow2DRectProj(s2DRS, v4); 236 237 v = shadow2DRectProjGradARB(s2DRS, v, v2, v2); 238} 239 240void voidTernary() 241{ 242 bool b; 243 b ? foo121111() : foo12111(); 244 b ? foo121111() : 4; // ERROR 245 b ? 3 : foo12111(); // ERROR 246} 247 248float halfFloat1 = 1.0h; // syntax ERROR 249