yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
bfaf88ee
main
1#version 300 es 2void nodef1 (float f );// ERROR, no default precision 3uniform sampler2D s2D ; 4uniform lowp sampler3D s3D ; 5uniform samplerCube sCube ; 6uniform lowp samplerCubeShadow sCubeShadow ; 7uniform lowp sampler2DShadow s2DShadow ; 8uniform lowp sampler2DArray s2DArray ; 9uniform lowp sampler2DArrayShadow s2DArrayShadow ; 10 11uniform lowp isampler2D is2D ; 12uniform lowp isampler3D is3D ; 13uniform lowp isamplerCube isCube ; 14uniform lowp isampler2DArray is2DArray ; 15 16uniform lowp usampler2D us2D ; 17uniform lowp usampler3D us3D ; 18uniform lowp usamplerCube usCube ; 19uniform lowp usampler2DArray us2DArray ; 20precision lowp float ; 21in float c1D; 22in vec2 c2D; 23in vec3 c3D; 24smooth vec4 c4D; 25 26flat in int ic1D; 27flat in ivec2 ic2D; 28flat in ivec3 ic3D; 29flat in ivec4 ic4D; 30noperspective in vec4 badv; // ERROR 31in sampler2D bads; // ERROR 32precision lowp uint ; // ERROR 33 34struct s { 35int i ; 36sampler2D s ; 37}; 38 39in s badout; // ERROR, can't contain a sampler 40// ERROR, can't have int in struct without flat 41struct S2 { 42vec3 c ; 43float f ; 44}; 45 46in S2 s2; 47 48out vec3 sc; 49out float sf; 50 51uniform sampler2D arrayedSampler[ 5 ]; 52 53void main() 54{ 55float f; 56vec4 v; 57v = texture(s2D, c2D); 58v = textureProj(s3D, c4D); 59v = textureLod(s2DArray, c3D, 1.2 ); 60f = textureOffset(s2DShadow, c3D, ic2D, c1D); // ERROR, offset argument not constant 61v = texelFetch(s3D, ic3D, ic1D); 62v = texelFetchOffset(arrayedSampler[ 2 ], ic2D, 4 , ic2D); // ERROR, offset argument not constant 63f = textureLodOffset(s2DShadow, c3D, c1D, ic2D); 64v = textureProjLodOffset(s2D, c3D, c1D, ic2D); 65v = textureGrad(sCube, c3D, c3D, c3D); 66f = textureGradOffset(s2DArrayShadow, c4D, c2D, c2D, ic2D); 67v = textureProjGrad(s3D, c4D, c3D, c3D); 68v = textureProjGradOffset(s2D, c3D, c2D, c2D, ic2D); 69v = texture(arrayedSampler[ic1D], c2D); // ERROR 70 71ivec4 iv; 72iv = texture(is2D, c2D); 73iv = textureProjOffset(is2D, c4D, ic2D); 74iv = textureProjLod(is2D, c3D, c1D); 75iv = textureProjGrad(is2D, c3D, c2D, c2D); 76iv = texture(is3D, c3D, 4.2 ); 77iv = textureLod(isCube, c3D, c1D); 78iv = texelFetch(is2DArray, ic3D, ic1D); 79 80iv. xy = textureSize(sCubeShadow, 2 ); 81 82float precise; 83double boo; // ERROR 84dvec2 boo2; // ERROR 85dvec3 boo3; // ERROR 86dvec4 boo4; // ERROR 87 88f += gl_FragCoord. y ; 89gl_FragDepth = f; 90 91sc = s2. c ; 92sf = s2. f ; 93 94sinh(c1D) + 95cosh(c1D) * tanh(c2D); 96asinh(c4D) + acosh(c4D); 97atanh(c3D); 98} 99 100uniform multi { 101int [ 2 ] a [ 3 ]; // ERROR 102int [ 2 ][ 3 ] b ; // ERROR 103int c[ 2 ][ 3 ]; // ERROR 104} multiInst [ 2 ][ 3 ]; // ERROR 105 106out vec4 colors [ 4 ]; 107 108void foo () 109{ 110colors [ 2 ] = c4D ; 111colors [ ic1D ] = c4D ; // ERROR 112} 113 114uniform s st1 ; 115uniform s st2 ; 116 117void foo13 ( s inSt2 ) 118{ 119if ( st1 == st2 ); // ERROR 120if ( st1 != st2 ); // ERROR 121st1 .s == st2 .s; // ERROR 122inSt2 = st1 ; // ERROR 123inSt2 == st1 ; // ERROR 124} 125 126void foo23 () 127{ 128textureOffset ( s2DShadow , c3D , ivec2 ( -8 , 7 ), c1D ); 129textureOffset ( s2DShadow , c3D , ivec2 ( -9 , 8 ), c1D ); 130} 131 132void foo324 ( void ) 133{ 134float p = pow ( 3.2 , 4.6 ); 135p += sin ( 0.4 ); 136p += distance ( vec2 ( 10.0 , 11.0 ), vec2 ( 13.0 , 15.0 )); // 5 137p += dot ( vec3 ( 2 , 3 , 5 ), vec3 ( -2 , -1 , 4 )); // 13 138vec3 c3 = cross ( vec3 ( 3 , -3 , 1 ), vec3 ( 4 , 9 , 2 )); // (-15, -2, 39) 139c3 += faceforward ( vec3 ( 1 , 2 , 3 ), vec3 ( 2 , 3 , 5 ), vec3 ( -2 , -1 , 4 )); // (-1,-2,-3) 140c3 += faceforward ( vec3 ( 1 , 2 , 3 ), vec3 ( -2 , -3 , -5 ), vec3 ( -2 , -1 , 4 )); // (1,2,3) 141vec2 c2 = reflect ( vec2 ( 1 , 3 ), vec2 ( 0 , 1 )); // (1,-3) 142c2 += refract ( vec2 ( 1 , 3 ), vec2 ( 0 , 1 ), 1.0 ); // (1,-3) 143c2 += refract ( vec2 ( 1 , 3 ), vec2 ( 0 , 1 ), 3.0 ); 144c2 += refract ( vec2 ( 1 , 0.1 ), vec2 ( 0 , 1 ), 5.0 ); // (0,0) 145mat3x2 m32 = outerProduct ( vec2 ( 2 , 3 ), vec3 ( 5 , 7 , 11 )); // rows: (10, 14, 22), (15, 21, 33) 146} 147 148uniform mediump ; // ERROR 149 150layout ( early_fragment_tests ) in ; // ERROR 151 152// Test extension GL_EXT_shader_integer_mix 153#extension GL_EXT_shader_integer_mix : enable 154bool b1 , b2 , b ; 155int x , y ; 156uint z , w ; 157 158void testmix () 159{ 160int ival = mix ( x , y , b ); 161ivec2 iv2 = mix ( ivec2 ( x ), ivec2 ( y ), bvec2 ( b )); 162ivec3 iv3 = mix ( ivec3 ( x ), ivec3 ( y ), bvec3 ( b )); 163ivec4 iv4 = mix ( ivec4 ( x ), ivec4 ( x ), bvec4 ( b )); 164uint uiv = mix ( z , w , b ); 165uvec2 uv2 = mix ( uvec2 ( z ), uvec2 ( z ), bvec2 ( b )); 166uvec3 uv3 = mix ( uvec3 ( z ), uvec3 ( z ), bvec3 ( b )); 167uvec4 uv4 = mix ( uvec4 ( z ), uvec4 ( z ), bvec4 ( b )); 168bool bv = mix ( b1 , b2 , b ); 169bvec2 bv2 = mix ( bvec2 ( b1 ), bvec2 ( b2 ), bvec2 ( b )); 170bvec3 bv3 = mix ( bvec3 ( b1 ), bvec3 ( b2 ), bvec3 ( b )); 171bvec4 bv4 = mix ( bvec4 ( b1 ), bvec4 ( b2 ), bvec4 ( b )); 172} 173 174#extension GL_EXT_shader_integer_mix : disable 175void testmixFail () 176{ 177int ival = mix ( x , y , b ); // Error since extenson GL_EXT_shader_integer_mix is disabled 178} 179 180// Test layout qualifier "index" with extension GL_EXT_blend_func_extended 181layout ( location = 0 , index = 1 ) out vec4 outVarFail ; // Error Index supported with extension GL_EXT_blend_func_extended enabled 182#extension GL_EXT_blend_func_extended : enable 183layout ( location = 0 , index = 2 ) out vec4 outVarPass ; 184 185#ifndef GL_FRAGMENT_PRECISION_HIGH 186#error missing GL_FRAGMENT_PRECISION_HIGH 187#endif 188 189invariant in ; // ERROR 190invariant in vec4 ; // ERROR 191invariant in vec4 fooinv; // ERROR 192 193float imageBuffer; // ERROR, reserved 194float uimage2DRect; // ERROR, reserved