1#version 310 es 2 3shared vec4 s; // ERROR 4layout(local_size_x = 2) out; // ERROR 5buffer vec4 v; // ERROR 6in int ini; 7layout(location = 2) uniform mat4 x; 8layout(location = 3) uniform mat4 y; 9layout(location = 2) out mat4 xi; 10layout(location = 3) out mat4 yi; // ERROR, locations conflict with xi 11 12void main() 13{ 14 uvec2 u2; 15 u2 = uaddCarry(u2, u2, u2); 16 uint u1; 17 u1 = usubBorrow(u1, u1, u1); 18 uvec4 u4; 19 umulExtended(u4, u4, u4, u4); 20 ivec4 i4; 21 imulExtended(i4, i4, i4, i4); 22 int i1; 23 i1 = bitfieldExtract(i1, 4, 5); 24 uvec3 u3; 25 u3 = bitfieldExtract(u3, 4, 5); 26 ivec3 i3; 27 i3 = bitfieldInsert(i3, i3, 4, 5); 28 u1 = bitfieldInsert(u1, u1, 4, 5); 29 ivec2 i2; 30 i2 = bitfieldReverse(i2); 31 u4 = bitfieldReverse(u4); 32 i1 = bitCount(i1); 33 i3 = bitCount(u3); 34 i2 = findLSB(i2); 35 i4 = findLSB(u4); 36 i1 = findMSB(i1); 37 i2 = findMSB(u2); 38 39 vec3 v3; 40 v3 = frexp(v3, i3); 41 vec2 v2; 42 v2 = ldexp(v2, i2); 43 44 mediump vec4 v4; 45 u1 = packUnorm4x8(v4); 46 u1 = packSnorm4x8(v4); 47 v4 = unpackUnorm4x8(u1); 48 v4 = unpackSnorm4x8(u1); 49} 50 51precision highp sampler2DMS; 52precision highp isampler2DMS; 53precision highp usampler2DMS; 54 55uniform sampler2DMS s2dms; 56uniform isampler2DMS is2dms; 57uniform usampler2DMS us2dms; 58uniform usampler2DMSArray us2dmsa; // ERROR 59 60void foo() 61{ 62 ivec2 v2; 63 v2 = textureSize(s2dms); 64 v2 = textureSize(us2dms); 65 vec4 v4 = texelFetch(s2dms, v2, 2); 66 ivec4 iv4 = texelFetch(is2dms, v2, 2); 67 textureSamples(s2dms); // ERROR 68 float f; 69 frexp(f, ini); // ERROR, i not writable 70} 71 72out bool outb; // ERROR 73out sampler2D outo; // ERROR 74out float outa[4]; 75out float outaa[4][2]; // ERROR 76struct S { float f; }; 77out S outs; 78out S[4] outasa; // ERROR 79out S outsa[4]; // ERROR 80struct SA { float f[4]; }; 81out SA outSA; // ERROR 82struct SS { float f; S s; }; 83out SS outSS; // ERROR 84 85layout(std430) uniform U430 { int a; } U430i; // ERROR 86layout(std430) buffer B430 { int a; } B430i; 87 88#ifndef GL_OES_shader_io_blocks 89#error GL_OES_shader_io_blocks not defined 90#endif 91 92#extension GL_OES_shader_io_blocks : enable 93 94out outbname { 95 int a; 96 out vec4 v; 97 highp sampler2D s; // ERROR, opaque type 98} outbinst; 99 100out outbname2 { 101 layout(location = 12) int aAnon; 102 layout(location = 13) vec4 vAnon; 103}; 104 105layout(location = 12) out highp int aliased; // ERROR, aliasing location 106 107in inbname { int a; } inbinst; // ERROR, no in block in vertex shader 108 109out gl_PerVertex { // ERROR, has extra member 110 highp vec4 gl_Position; 111 highp vec4 t; 112}; 113 114void foo_IO() 115{ 116 int sum = gl_VertexID + 117 gl_InstanceID; 118 gl_Position = vec4(1.0); 119 gl_PointSize = 2.0; // ERROR, removed by redeclaration 120} 121 122out gl_PerVertex { // ERROR, already used and already redeclared 123 highp vec4 gl_Position; 124 highp vec4 t; 125}; 126 127smooth out smo { // ERROR, no smooth on a block 128 int i; 129} smon; 130 131flat out fmo { // ERROR, no flat on a block 132 int i; 133} fmon; 134 135centroid out cmo { // ERROR, no centroid on a block 136 int i; 137} cmon; 138 139invariant out imo { // ERROR, no invariant on a block 140 int i; 141} imon; 142 143in vec2 inf, ing; 144uniform ivec2 offsets[4]; 145uniform sampler2D sArray[4]; 146uniform int sIndex; 147layout(binding = 0) uniform atomic_uint auArray[2]; 148uniform ubName { int i; } ubInst[4]; 149buffer bbName { int i; } bbInst[4]; 150highp uniform writeonly image2D iArray[5]; 151const ivec2 constOffsets[4] = ivec2[4](ivec2(0.1), ivec2(0.2), ivec2(0.3), ivec2(0.4)); 152 153void pfooBad() 154{ 155 precise vec2 h; // ERROR reserved 156 h = fma(inf, ing, h); // ERROR, not available 157 sArray[sIndex + 1]; // ERRRO, not supported 158 auArray[sIndex + 1]; 159 ubInst[1]; 160 bbInst[2]; 161 ubInst[sIndex + 1]; // ERROR, not supported 162 bbInst[sIndex]; // ERROR, not supported 163 iArray[2]; 164 iArray[sIndex * 2]; // ERROR, not supported 165 textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf)); // ERROR, offset not constant 166 textureGatherOffsets(sArray[0], vec2(0.1), constOffsets); // ERROR, not available 167} 168 169#extension GL_OES_gpu_shader5 : enable 170 171void pfoo() 172{ 173 precise vec2 h; 174 h = fma(inf, ing, h); 175 sArray[sIndex + 1]; 176 ubInst[sIndex + 1]; 177 bbInst[sIndex - 2]; // ERROR, still not supported 178 iArray[2]; 179 iArray[sIndex - 2]; 180 textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf)); 181 textureGatherOffsets(sArray[0], vec2(0.1), constOffsets); 182 textureGatherOffsets(sArray[0], vec2(0.1), offsets); // ERROR, offset not constant 183} 184 185uniform samplerBuffer badSamp1; // ERROR, reserved 186uniform isamplerBuffer badSamp2; // ERROR, reserved 187uniform usamplerBuffer badSamp3; // ERROR, reserved 188uniform writeonly imageBuffer badSamp4; // ERROR, reserved 189uniform writeonly iimageBuffer badSamp5; // ERROR, reserved 190uniform writeonly uimageBuffer badSamp6; // ERROR, reserved 191 192#extension GL_OES_texture_buffer : enable 193#extension GL_EXT_texture_buffer : enable 194 195uniform samplerBuffer noPreSamp1; // ERROR, no default precision 196uniform isamplerBuffer noPreSamp2; // ERROR, no default precision 197uniform usamplerBuffer noPreSamp3; // ERROR, no default precision 198uniform writeonly imageBuffer noPreSamp4; // ERROR, no default precision 199uniform writeonly iimageBuffer noPreSamp5; // ERROR, no default precision 200uniform writeonly uimageBuffer noPreSamp6; // ERROR, no default precision 201 202precision highp samplerBuffer; 203precision highp isamplerBuffer; 204precision highp usamplerBuffer; 205precision highp imageBuffer; 206precision highp iimageBuffer; 207precision highp uimageBuffer; 208 209#ifdef GL_OES_texture_buffer 210uniform samplerBuffer bufSamp1; 211uniform isamplerBuffer bufSamp2; 212uniform usamplerBuffer bufSamp3; 213#endif 214#ifdef GL_EXT_texture_buffer 215uniform writeonly imageBuffer bufSamp4; 216uniform writeonly iimageBuffer bufSamp5; 217uniform writeonly uimageBuffer bufSamp6; 218#endif 219 220void bufferT() 221{ 222 highp int s1 = textureSize(bufSamp1); 223 highp int s2 = textureSize(bufSamp2); 224 highp int s3 = textureSize(bufSamp3); 225 226 highp int s4 = imageSize(bufSamp4); 227 highp int s5 = imageSize(bufSamp5); 228 highp int s6 = imageSize(bufSamp6); 229 230 highp vec4 f1 = texelFetch(bufSamp1, s1); 231 highp ivec4 f2 = texelFetch(bufSamp2, s2); 232 highp uvec4 f3 = texelFetch(bufSamp3, s3); 233} 234 235uniform writeonly imageCubeArray badCA1; // ERROR, reserved 236uniform writeonly iimageCubeArray badCA2; // ERROR, reserved 237uniform writeonly uimageCubeArray badCA3; // ERROR, reserved 238 239uniform samplerCubeArray badCA4; // ERROR, reserved 240uniform samplerCubeArrayShadow badCA5; // ERROR, reserved 241uniform isamplerCubeArray badCA6; // ERROR, reserved 242uniform usamplerCubeArray badCA7; // ERROR, reserved 243 244#extension GL_OES_texture_cube_map_array : enable 245 246uniform writeonly imageCubeArray noPreCA1; // ERROR, no default precision 247uniform writeonly iimageCubeArray noPreCA2; // ERROR, no default precision 248uniform writeonly uimageCubeArray noPreCA3; // ERROR, no default precision 249 250uniform samplerCubeArray noPreCA4; // ERROR, no default precision 251uniform samplerCubeArrayShadow noPreCA5; // ERROR, no default precision 252uniform isamplerCubeArray noPreCA6; // ERROR, no default precision 253uniform usamplerCubeArray noPreCA7; // ERROR, no default precision 254 255precision highp imageCubeArray ; 256precision highp iimageCubeArray ; 257precision highp uimageCubeArray ; 258 259precision highp samplerCubeArray ; 260precision highp samplerCubeArrayShadow; 261precision highp isamplerCubeArray ; 262precision highp usamplerCubeArray ; 263 264uniform writeonly imageCubeArray CA1; 265uniform writeonly iimageCubeArray CA2; 266uniform writeonly uimageCubeArray CA3; 267 268layout(rgba16f) uniform readonly imageCubeArray rCA1; 269layout(rgba32i) uniform readonly iimageCubeArray rCA2; 270layout(r32ui) uniform readonly uimageCubeArray rCA3; 271 272#ifdef GL_OES_texture_cube_map_array 273uniform samplerCubeArray CA4; 274uniform samplerCubeArrayShadow CA5; 275uniform isamplerCubeArray CA6; 276uniform usamplerCubeArray CA7; 277#endif 278 279void CAT() 280{ 281 highp ivec3 s4 = textureSize(CA4, 1); 282 highp ivec3 s5 = textureSize(CA5, 1); 283 highp ivec3 s6 = textureSize(CA6, 1); 284 highp ivec3 s7 = textureSize(CA7, 1); 285 286 highp vec4 t4 = texture(CA4, vec4(0.5)); 287 highp float t5 = texture(CA5, vec4(0.5), 3.0); 288 highp ivec4 t6 = texture(CA6, vec4(0.5)); 289 highp uvec4 t7 = texture(CA7, vec4(0.5)); 290 291 highp vec4 L4 = textureLod(CA4, vec4(0.5), 0.24); 292 highp ivec4 L6 = textureLod(CA6, vec4(0.5), 0.26); 293 highp uvec4 L7 = textureLod(CA7, vec4(0.5), 0.27); 294 295 highp vec4 g4 = textureGrad(CA4, vec4(0.5), vec3(0.1), vec3(0.2)); 296 highp ivec4 g6 = textureGrad(CA6, vec4(0.5), vec3(0.1), vec3(0.2)); 297 highp uvec4 g7 = textureGrad(CA7, vec4(0.5), vec3(0.1), vec3(0.2)); 298 299 highp vec4 gath4 = textureGather(CA4, vec4(0.5)); 300 highp vec4 gathC4 = textureGather(CA4, vec4(0.5), 2); 301 highp ivec4 gath6 = textureGather(CA6, vec4(0.5)); 302 highp ivec4 gathC6 = textureGather(CA6, vec4(0.5), 1); 303 highp uvec4 gath7 = textureGather(CA7, vec4(0.5)); 304 highp uvec4 gathC7 = textureGather(CA7, vec4(0.5), 0); 305 306 highp vec4 gath5 = textureGather(CA5, vec4(0.5), 2.5); 307 308 highp ivec3 s1 = imageSize(CA1); 309 highp ivec3 s2 = imageSize(CA2); 310 highp ivec3 s3 = imageSize(CA3); 311 312 imageStore(CA1, s3, vec4(1)); 313 imageStore(CA2, s3, ivec4(1)); 314 imageStore(CA3, s3, uvec4(1)); 315 316 highp vec4 cl1 = imageLoad(rCA1, s3); 317 highp ivec4 cl2 = imageLoad(rCA2, s3); 318 highp uvec4 cl3 = imageLoad(rCA3, s3); 319} 320 321uniform sampler2DMSArray bad2DMS; // ERROR, reserved 322uniform isampler2DMSArray bad2DMSi; // ERROR, reserved 323uniform usampler2DMSArray bad2DMSu; // ERROR, reserved 324 325#extension GL_OES_texture_storage_multisample_2d_array : enable 326 327#ifdef GL_OES_texture_storage_multisample_2d_array 328 329uniform sampler2DMSArray noPrec2DMS; // ERROR, no default 330uniform isampler2DMSArray noPrec2DMSi; // ERROR, no default 331uniform usampler2DMSArray noPrec2DMSu; // ERROR, no default 332 333#endif 334 335precision highp sampler2DMSArray; 336precision highp isampler2DMSArray; 337precision highp usampler2DMSArray; 338 339uniform sampler2DMSArray samp2DMSA; 340uniform isampler2DMSArray samp2DMSAi; 341uniform usampler2DMSArray samp2DMSAu; 342 343void MSA() 344{ 345 vec4 tf = texelFetch(samp2DMSA, ivec3(5), 2); 346 ivec4 tfi = texelFetch(samp2DMSAi, ivec3(5), 2); 347 uvec4 tfu = texelFetch(samp2DMSAu, ivec3(5), 2); 348 349 ivec3 tfs = textureSize(samp2DMSA); 350 ivec3 tfsi = textureSize(samp2DMSAi); 351 ivec3 tfsb = textureSize(samp2DMSAi, 4); // ERROR, no lod 352 ivec3 tfsu = textureSize(samp2DMSAu); 353} 354 355#ifdef GL_OES_shader_image_atomic 356#extension GL_OES_shader_image_atomic : enable 357#endif 358 359uniform layout(r32f) highp image2D im2Df; 360uniform layout(r32ui) highp uimage2D im2Du; 361uniform layout(r32i) highp iimage2D im2Di; 362uniform ivec2 P; 363 364void goodImageAtom() 365{ 366 float datf; 367 int dati; 368 uint datu; 369 370 imageAtomicAdd( im2Di, P, dati); 371 imageAtomicAdd( im2Du, P, datu); 372 imageAtomicMin( im2Di, P, dati); 373 imageAtomicMin( im2Du, P, datu); 374 imageAtomicMax( im2Di, P, dati); 375 imageAtomicMax( im2Du, P, datu); 376 imageAtomicAnd( im2Di, P, dati); 377 imageAtomicAnd( im2Du, P, datu); 378 imageAtomicOr( im2Di, P, dati); 379 imageAtomicOr( im2Du, P, datu); 380 imageAtomicXor( im2Di, P, dati); 381 imageAtomicXor( im2Du, P, datu); 382 imageAtomicExchange(im2Di, P, dati); 383 imageAtomicExchange(im2Du, P, datu); 384 imageAtomicExchange(im2Df, P, datf); 385 imageAtomicCompSwap(im2Di, P, 3, dati); 386 imageAtomicCompSwap(im2Du, P, 5u, datu); 387} 388 389sample out vec4 colorSampInBad; // ERROR, reserved 390 391#extension GL_OES_shader_multisample_interpolation : enable 392 393sample out vec4 colorSample; 394flat sample out vec4 colorfsi; 395sample out vec3 sampInArray[4]; 396in vec4 inv4; 397 398void badInterp() 399{ 400 interpolateAtCentroid(inv4); // ERROR, wrong stage 401 interpolateAtSample(inv4, 1); // ERROR, need extension 402 interpolateAtOffset(inv4, vec2(0.2)); // ERROR, need extension 403} 404