2 highp float nodef3(float); // ERROR, no default precision
\r
3 precision mediump float;
\r
4 precision highp usampler2D;
\r
5 precision highp sampler2D;
\r
6 precision highp isampler2DArray;
\r
8 layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR, not supported
\r
10 layout(location = 2) in vec3 v3;
\r
11 layout(location = 2) in mat4 yi; // ERROR, locations conflict with xi
\r
13 uniform sampler2D arrayedSampler[5];
\r
14 uniform usampler2D usamp2d;
\r
15 uniform usampler2DRect samp2dr; // ERROR, reserved
\r
16 uniform isampler2DArray isamp2DA;
\r
23 vec4 v = texture(arrayedSampler[i], c2D); // ERROR
\r
26 const ivec2 constOffsets[4] = ivec2[4](ivec2(1,2), ivec2(3,4), ivec2(15,16), ivec2(-2,0));
\r
27 uvec4 uv4 = textureGatherOffsets(samp2dr, c2D, offsets, 2); // ERROR, not supported
\r
28 vec4 v4 = textureGather(arrayedSampler[0], c2D);
\r
29 ivec4 iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 3);
\r
30 iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), i); // ERROR, last argument not const
\r
31 iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 4); // ERROR, last argument out of range
\r
32 iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 1+2);
\r
33 iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(0.5));
\r
34 iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(i)); // ERROR, offset not constant
\r
40 const ivec2[3] offsets = ivec2[3](ivec2(1,2), ivec2(3,4), ivec2(15,16));
\r
42 textureProjGradOffset(usamp2d, outp, vec2(0.0), vec2(0.0), ivec2(c2D)); // ERROR, offset not constant
\r
43 textureProjGradOffset(usamp2d, outp, vec2(0.0), vec2(0.0), offsets[1]);
\r
44 textureProjGradOffset(usamp2d, outp, vec2(0.0), vec2(0.0), offsets[2]); // ERROR, offset out of range
\r
45 textureProjGradOffset(usamp2d, outp, vec2(0.0), vec2(0.0), ivec2(-10, 20)); // ERROR, offset out of range
\r
47 if (gl_HelperInvocation)
\r
50 int sum = gl_MaxVertexImageUniforms +
\r
51 gl_MaxFragmentImageUniforms +
\r
52 gl_MaxComputeImageUniforms +
\r
53 gl_MaxCombinedImageUniforms +
\r
54 gl_MaxCombinedShaderOutputResources;
\r
58 b1 = mix(b2, b3, b);
\r
59 uvec3 um3 = mix(uvec3(i), uvec3(i), bvec3(b));
\r
60 ivec4 im4 = mix(ivec4(i), ivec4(i), bvec4(b));
\r
61 1 << mix(1u, 1u, false); // does not require folding
63 layout(binding=3) uniform sampler2D s1;
\r
64 layout(binding=3) uniform sampler2D s2; // ERROR: overlapping bindings? Don't see that in the 310 spec.
\r
65 highp layout(binding=2) uniform writeonly image2D i2D;
\r
66 layout(binding=4) uniform readonly image3D i3D; // ERROR, no default precision
\r
67 layout(binding=5) uniform imageCube iCube; // ERROR, no default precision
\r
68 layout(binding=6) uniform image2DArray i2DA; // ERROR, no default precision
\r
69 layout(binding=6) uniform coherent volatile restrict image2D i2Dqualified; // ERROR, no default precision
\r
71 layout(binding = 1) uniform bb {
\r
73 layout(binding = 2) float f; // ERROR
\r
76 in centroid vec4 centroidIn;
\r
77 layout(location = 200000) uniform vec4 bigl; // ERROR, location too big
\r
79 layout(early_fragment_tests) in;
\r
81 layout(location = 40) out vec4 bigout1; // ERROR, too big
\r
82 layout(location = 40) out vec4 bigout2; // ERROR, overlap
\r
83 layout(location = -2) out vec4 neg; // ERROR, negative
\r
85 layout(std430) buffer b430 {
\r
89 layout(shared) uniform bshar {
\r
93 in smooth vec4 smoothIn;
\r
96 uniform sampler2DMS s2dms; // ERROR, no default precision qualifier
\r
100 highp ivec2 v2 = textureSize(s1, 2);
\r
101 highp ivec3 v3 = textureSize(isamp2DA, 3);
\r
102 v2 = textureSize(s2dms);
\r
103 v2 = imageSize(i2D);
\r
104 v3 = imageSize(i3D);
\r
105 v2 = imageSize(iCube);
\r
106 v3 = imageSize(i2DA);
\r
107 v2 = imageSize(i2Dqualified);
\r
110 out bool bout; // ERROR
\r
111 highp out image2D imageOut; // ERROR
\r
112 out mat2x3 mout; // ERROR
\r
114 in bool inb; // ERROR
\r
115 in sampler2D ino; // ERROR
\r
117 in float inaa[4][2]; // ERROR
\r
118 struct S { float f; };
\r
120 in S[4] inasa; // ERROR
\r
121 in S insa[4]; // ERROR
\r
122 struct SA { float f[4]; };
\r
123 in SA inSA; // ERROR
\r
124 struct SS { float f; S s; };
\r
125 in SS inSS; // ERROR
\r
127 #ifndef GL_EXT_shader_io_blocks
\r
128 #error GL_EXT_shader_io_blocks not defined
\r
131 #extension GL_EXT_shader_io_blocks : enable
\r
133 out outbname { int a; } outbinst; // ERROR, not out block in fragment shader
\r
138 struct { int b; } s; // ERROR, nested struct definition
\r
142 layout(location = 12) int aAnon;
\r
143 layout(location = 13) centroid in vec4 vAnon;
\r
146 in layout(location = 13) vec4 aliased; // ERROR, aliased
\r
148 in inbname2 { // ERROR, reuse of block name
\r
150 centroid in vec4 vAnon;
\r
153 in badmember { // ERROR, aAnon already in global scope
\r
157 int inbname; // ERROR, redefinition of block name
\r
159 vec4 vAnon; // ERROR, anon in global scope; redefinition
\r
167 vec4 v = inbinst.v + vAnon;
\r
168 v *= arrayedInst[2].f;
\r
169 v *= arrayedInst[i].f;
\r
172 in vec4 gl_FragCoord;
\r
173 layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR, non-ES
\r
175 layout(early_fragment_tests) in;
\r
176 out float gl_FragDepth;
\r
177 layout(depth_any) out float gl_FragDepth; // ERROR, non-ES
\r
181 gl_FragDepth = 0.2; // ERROR, early_fragment_tests declared
\r
182 gl_Layer; // ERROR, not present
\r
183 gl_PrimitiveID; // ERROR, not present
\r
184 bool f = gl_FrontFacing;
\r
187 out float gl_FragDepth;
\r
189 #extension GL_OES_geometry_shader : enable
\r
193 highp int l = gl_Layer;
\r
194 highp int p = gl_PrimitiveID;
\r
198 uniform ivec2 offsets[4];
\r
199 uniform sampler2D sArray[4];
\r
200 uniform int sIndex;
\r
201 layout(binding = 0) uniform atomic_uint auArray[2];
\r
202 uniform ubName { int i; } ubInst[4];
\r
203 buffer bbName { int i; } bbInst[4];
\r
204 highp uniform writeonly image2D iArray[5];
\r
205 const ivec2 constOffsets[4] = ivec2[4](ivec2(0.1), ivec2(0.2), ivec2(0.3), ivec2(0.4));
\r
209 precise vec2 h; // ERROR reserved
\r
210 h = fma(inf, ing, h); // ERROR, not available
\r
211 textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf)); // ERROR, offset not constant
\r
212 textureGatherOffsets(sArray[0], vec2(0.1), constOffsets); // ERROR, not available
\r
215 #extension GL_OES_gpu_shader5 : enable
\r
220 h = fma(inf, ing, h);
\r
221 textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf));
\r
222 textureGatherOffsets(sArray[0], vec2(0.1), constOffsets);
\r
223 textureGatherOffsets(sArray[0], vec2(0.1), offsets); // ERROR, offset not constant
\r
226 #extension GL_EXT_texture_cube_map_array : enable
\r
228 precision highp imageCubeArray ;
\r
229 precision highp iimageCubeArray ;
\r
230 precision highp uimageCubeArray ;
\r
232 precision highp samplerCubeArray ;
\r
233 precision highp samplerCubeArrayShadow;
\r
234 precision highp isamplerCubeArray ;
\r
235 precision highp usamplerCubeArray ;
\r
237 uniform writeonly imageCubeArray CA1;
\r
238 uniform writeonly iimageCubeArray CA2;
\r
239 uniform writeonly uimageCubeArray CA3;
\r
241 #ifdef GL_EXT_texture_cube_map_array
\r
242 uniform samplerCubeArray CA4;
\r
243 uniform samplerCubeArrayShadow CA5;
\r
244 uniform isamplerCubeArray CA6;
\r
245 uniform usamplerCubeArray CA7;
\r
250 highp vec4 b4 = texture(CA4, vec4(0.5), 0.24);
\r
251 highp ivec4 b6 = texture(CA6, vec4(0.5), 0.26);
\r
252 highp uvec4 b7 = texture(CA7, vec4(0.5), 0.27);
\r
257 lowp int a1 = gl_SampleID; // ERROR, need extension
\r
258 mediump vec2 a2 = gl_SamplePosition; // ERROR, need extension
\r
259 highp int a3 = gl_SampleMaskIn[0]; // ERROR, need extension
\r
260 gl_SampleMask[0] = a3; // ERROR, need extension
\r
261 mediump int n = gl_NumSamples; // ERROR, need extension
\r
264 #ifdef GL_OES_sample_variables
\r
265 #extension GL_OES_sample_variables : enable
\r
270 lowp int a1 = gl_SampleID;
\r
271 mediump vec2 a2 = gl_SamplePosition;
\r
272 highp int a3 = gl_SampleMaskIn[0];
\r
273 gl_SampleMask[0] = a3;
\r
274 mediump int n1 = gl_MaxSamples;
\r
275 mediump int n2 = gl_NumSamples;
\r
278 uniform layout(r32f) highp image2D im2Df;
\r
279 uniform layout(r32ui) highp uimage2D im2Du;
\r
280 uniform layout(r32i) highp iimage2D im2Di;
\r
283 void badImageAtom()
\r
289 imageAtomicAdd( im2Di, P, dati); // ERROR, need extension
290 imageAtomicAdd( im2Du, P, datu); // ERROR, need extension
291 imageAtomicMin( im2Di, P, dati); // ERROR, need extension
292 imageAtomicMin( im2Du, P, datu); // ERROR, need extension
293 imageAtomicMax( im2Di, P, dati); // ERROR, need extension
294 imageAtomicMax( im2Du, P, datu); // ERROR, need extension
295 imageAtomicAnd( im2Di, P, dati); // ERROR, need extension
296 imageAtomicAnd( im2Du, P, datu); // ERROR, need extension
297 imageAtomicOr( im2Di, P, dati); // ERROR, need extension
298 imageAtomicOr( im2Du, P, datu); // ERROR, need extension
299 imageAtomicXor( im2Di, P, dati); // ERROR, need extension
300 imageAtomicXor( im2Du, P, datu); // ERROR, need extension
301 imageAtomicExchange(im2Di, P, dati); // ERROR, need extension
302 imageAtomicExchange(im2Du, P, datu); // ERROR, need extension
303 imageAtomicExchange(im2Df, P, datf); // ERROR, need extension
304 imageAtomicCompSwap(im2Di, P, 3, dati); // ERROR, need extension
\r
305 imageAtomicCompSwap(im2Du, P, 5u, datu); // ERROR, need extension
\r
308 #ifdef GL_OES_shader_image_atomic
\r
309 #extension GL_OES_shader_image_atomic : enable
\r
312 uniform layout(rgba32f) highp image2D badIm2Df; // ERROR, needs readonly or writeonly
\r
313 uniform layout(rgba8ui) highp uimage2D badIm2Du; // ERROR, needs readonly or writeonly
\r
314 uniform layout(rgba16i) highp iimage2D badIm2Di; // ERROR, needs readonly or writeonly
\r
316 void goodImageAtom()
\r
322 imageAtomicAdd( im2Di, P, dati);
323 imageAtomicAdd( im2Du, P, datu);
324 imageAtomicMin( im2Di, P, dati);
325 imageAtomicMin( im2Du, P, datu);
326 imageAtomicMax( im2Di, P, dati);
327 imageAtomicMax( im2Du, P, datu);
328 imageAtomicAnd( im2Di, P, dati);
329 imageAtomicAnd( im2Du, P, datu);
330 imageAtomicOr( im2Di, P, dati);
331 imageAtomicOr( im2Du, P, datu);
332 imageAtomicXor( im2Di, P, dati);
333 imageAtomicXor( im2Du, P, datu);
334 imageAtomicExchange(im2Di, P, dati);
335 imageAtomicExchange(im2Du, P, datu);
336 imageAtomicExchange(im2Df, P, datf);
337 imageAtomicCompSwap(im2Di, P, 3, dati);
\r
338 imageAtomicCompSwap(im2Du, P, 5u, datu);
\r
340 imageAtomicMax(badIm2Di, P, dati); // ERROR, not an allowed layout() on the image
341 imageAtomicMax(badIm2Du, P, datu); // ERROR, not an allowed layout() on the image
342 imageAtomicExchange(badIm2Df, P, datf); // ERROR, not an allowed layout() on the image
345 sample in vec4 colorSampInBad; // ERROR, reserved
\r
346 centroid out vec4 colorCentroidBad; // ERROR
\r
347 flat out vec4 colorBadFlat; // ERROR
\r
348 smooth out vec4 colorBadSmooth; // ERROR
\r
349 noperspective out vec4 colorBadNo; // ERROR
\r
350 flat centroid in vec2 colorfc;
\r
355 interpolateAtCentroid(colorfc); // ERROR, need extension
\r
356 interpolateAtSample(colorfc, 1); // ERROR, need extension
\r
357 interpolateAtOffset(colorfc, vec2(0.2)); // ERROR, need extension
\r
360 #if defined GL_OES_shader_multisample_interpolation
\r
361 #extension GL_OES_shader_multisample_interpolation : enable
\r
364 sample in vec4 colorSampIn;
\r
365 sample out vec4 colorSampleBad; // ERROR
\r
366 flat sample in vec4 colorfsi;
\r
367 sample in vec3 sampInArray[4];
\r
376 res2 = interpolateAtCentroid(colorfc);
\r
377 res4 = interpolateAtCentroid(colorSampIn);
\r
378 res4 = interpolateAtCentroid(colorfsi);
\r
379 res = interpolateAtCentroid(scalarIn);
\r
380 res3 = interpolateAtCentroid(sampInArray); // ERROR
\r
381 res3 = interpolateAtCentroid(sampInArray[2]);
\r
382 res2 = interpolateAtCentroid(sampInArray[2].xy); // ERROR
\r
384 res3 = interpolateAtSample(sampInArray, 1); // ERROR
\r
385 res3 = interpolateAtSample(sampInArray[i], 0);
\r
386 res2 = interpolateAtSample(sampInArray[2].xy, 2); // ERROR
\r
387 res = interpolateAtSample(scalarIn, 1);
\r
389 res3 = interpolateAtOffset(sampInArray, vec2(0.2)); // ERROR
\r
390 res3 = interpolateAtOffset(sampInArray[2], vec2(0.2));
\r
391 res2 = interpolateAtOffset(sampInArray[2].xy, vec2(0.2)); // ERROR, no swizzle
\r
392 res = interpolateAtOffset(scalarIn + scalarIn, vec2(0.2)); // ERROR, no binary ops other than dereference
\r
393 res = interpolateAtOffset(scalarIn, vec2(0.2));
\r
396 res = interpolateAtCentroid(f); // ERROR, not interpolant
\r
397 res4 = interpolateAtSample(outp, 0); // ERROR, not interpolant
\r
400 layout(blend_support_softlight) out; // ERROR, need extension
\r
402 #ifdef GL_KHR_blend_equation_advanced
\r
403 #extension GL_KHR_blend_equation_advanced : enable
\r
406 layout(blend_support_multiply) out;
407 layout(blend_support_screen) out;
408 layout(blend_support_overlay) out;
409 layout(blend_support_darken, blend_support_lighten) out;
410 layout(blend_support_colordodge) layout(blend_support_colorburn) out;
411 layout(blend_support_hardlight) out;
412 layout(blend_support_softlight) out;
413 layout(blend_support_difference) out;
414 layout(blend_support_exclusion) out;
415 layout(blend_support_hsl_hue) out;
416 layout(blend_support_hsl_saturation) out;
417 layout(blend_support_hsl_color) out;
418 layout(blend_support_hsl_luminosity) out;
419 layout(blend_support_all_equations) out;
421 layout(blend_support_hsl_luminosity) out; // okay to repeat
423 layout(blend_support_hsl_luminosity) in; // ERROR, only on "out"
424 layout(blend_support_hsl_luminosity) out vec4; // ERROR, only on standalone
425 layout(blend_support_hsl_luminosity) out vec4 badout; // ERROR, only on standalone
426 layout(blend_support_hsl_luminosity) struct badS {int i;}; // ERROR, only on standalone
427 layout(blend_support_hsl_luminosity) void blendFoo() { } // ERROR, only on standalone
428 void blendFoo(layout(blend_support_hsl_luminosity) vec3 v) { } // ERROR, only on standalone
429 layout(blend_support_flizbit) out; // ERROR, no flizbit
431 out vec4 outAA[2][2]; // ERROR
435 gl_DeviceIndex; // ERROR, no extension
436 gl_ViewIndex; // ERROR, no extension
439 #ifdef GL_EXT_device_group
440 #extension GL_EXT_device_group : enable
443 #ifdef GL_EXT_multiview
444 #extension GL_EXT_multiview : enable
453 #extension GL_EXT_shader_implicit_conversions : enable
\r
455 // Test function overloading
\r
456 void func(uint a, uvec4 b)
\r
461 int func(uint a, uvec4 b) // Error function overloading because of same signature and different return type
\r
468 void testimplicit() {
\r
470 uint a = b; // int->uint
\r
471 mediump vec4 col = vec4(1, 2, 3, 4); // ivec4 -> vec4
\r
472 int b = a + 2; // ERROR: cannot convert from ' temp uint' to ' temp int'
\r
478 uint f = (b > 3)? b : c;
\r
479 func(b, ivec4(1,2,3,4));
\r
482 #extension GL_EXT_shader_implicit_conversions : disable
\r
484 void testimplicitFail() {
\r
485 uint a = b; // Error GL_EXT_shader_implicit_conversions is disabled
\r