yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
bfaf88ee
16.6.0
1// okay 2#version 100 3int a [ 3 ] = { 2 , 3 , 4 , } ; // ERROR (lots) 4#version 100 5int uint ; 6 7attribute vec4 v [ 3 ] ; // ERROR 8 9float f = 2 ; // ERROR 10 11uniform block { // ERROR 12int x ; 13} ; 14 15void foo ( float ) ; 16 17void main () 18{ 19foo ( 3 ) ; // ERROR 20int s = 1 << 4 ; // ERROR 21s = 16 >> 2 ; // ERROR 22if ( a == a ) ; // ERROR 23int b , c ; 24b = c & 4 ; // ERROR 25b = c % 4 ; // ERROR 26b = c | 4 ; // ERROR 27b >>= 2 ; // ERROR 28b <<= 2 ; // ERROR 29b %= 3 ; // ERROR 30 31struct S { 32float f ; 33float a [ 10 ] ; 34} s1 , s2 ; 35 36s1 = s2 ; // ERROR 37if ( s1 == s2 ) ; // ERROR 38if ( s1 != s2 ) ; // ERROR 39 40switch ( b ) { // ERROR 41} 42} 43 44invariant gl_FragColor ; 45float fa [] ; // ERROR 46float f13 ; 47invariant f13 ; // ERROR 48struct S { int a ; } ; 49invariant S ; // ERROR, not an input or output 50invariant float fi ; // ERROR 51varying vec4 av ; 52invariant av ; // okay in v100 53 54void foo10 () 55{ 56invariant f ; // ERROR 57invariant float f2 ; // ERROR 58float f3 ; 59invariant f3 ; // ERROR 60} 61 62uniform vec2 uv2 ; 63invariant uv2 ; // ERROR 64invariant uniform vec3 uv3 ; // ERROR 65 66sampler2D glob2D ; // ERROR 67void f11 ( sampler2D p2d ) 68{ 69sampler2D v2D ; // ERROR 70} 71varying sampler2D vary2D ; // ERROR 72 73struct sp { 74highp float f ; 75in float g ; // ERROR 76uniform float h ; // ERROR 77invariant float i ; // ERROR 78} ; 79 80uniform sampler3D s3D ; // ERROR 81 82#extension GL_OES_texture_3D : enable 83 84precision highp sampler3D ; 85uniform sampler3D s3D2 ; 86 87void foo234 () 88{ 89texture3D ( s3D2 , vec3 ( 0.2 ) , 0.2 ) ; 90texture3DProj ( s3D2 , v [ 1 ] , 0.4 ) ; 91dFdx ( v [ 0 ]) ; // ERROR 92dFdy ( 3.2 ) ; // ERROR 93fwidth ( f13 ) ; // ERROR 94} 95 96#extension GL_OES_standard_derivatives : enable 97 98void foo236 () 99{ 100dFdx ( v [ 0 ]) ; 101dFdy ( 3.2 ) ; 102fwidth ( f13 ) ; 103gl_FragDepth = f13 ; // ERROR 104gl_FragDepthEXT = f13 ; // ERROR 105} 106 107#extension GL_EXT_frag_depth : enable 108 109void foo239 () 110{ 111gl_FragDepth = f13 ; // ERROR 112gl_FragDepthEXT = f13 ; 113} 114 115#extension GL_OES_EGL_image_external : enable 116 117uniform samplerExternalOES sExt ; 118 119void foo245 () 120{ 121texture2D ( sExt , vec2 ( 0.2 )) ; 122texture2DProj ( sExt , vec3 ( f13 )) ; 123texture2DProj ( sExt , v [ 2 ]) ; 124} 125 126precision mediump samplerExternalOES ; 127uniform samplerExternalOES mediumExt ; 128uniform highp samplerExternalOES highExt ; 129 130void foo246 () 131{ 132texture2D ( mediumExt , vec2 ( 0.2 )) ; 133texture2DProj ( highExt , v [ 2 ]) ; 134texture3D ( sExt , vec3 ( f13 )) ; // ERROR 135texture2DProjLod ( sExt , vec3 ( f13 ) , f13 ) ; // ERROR 136int a ; 137~ a ; // ERROR 138a | a ; // ERROR 139a & a ; // ERROR 140} 141 142#extension GL_OES_EGL_image_external : disable 143uniform sampler2D s2Dg ; 144 145int foo203940 ( int a , float b , float a ) // ERROR, a redefined 146{ 147texture2DProjGradEXT ( s2Dg , vec3 ( f13 ) , uv2 , uv2 ) ; // ERROR, extension not enabled 148return a ; 149} 150 151float f123 = 4.0f ; // ERROR 152float f124 = 5e10F ; // ERROR 153 154#extension GL_EXT_shader_texture_lod : enable 155 156uniform samplerCube sCube ; 157 158void foo323433 () 159{ 160texture2DLodEXT ( s2Dg , uv2 , f13 ) ; 161texture2DProjGradEXT ( s2Dg , vec3 ( f13 ) , uv2 , uv2 ) ; 162texture2DGradEXT ( s2Dg , uv2 , uv2 , uv2 ) ; 163textureCubeGradEXT ( sCube , vec3 ( f13 ) , vec3 ( f13 ) , vec3 ( f13 )) ; 164} 165 166int fgfg ( float f , mediump int i ) ; 167int fgfg ( float f , highp int i ) { return 2 ; } // ERROR, precision qualifier difference 168 169int fffg ( float f ) ; 170int fffg ( float f ) ; // ERROR, can't have multiple prototypes 171 172int gggf ( float f ) ; 173int gggf ( float f ) { return 2 ; } 174 175int agggf ( float f ) { return 2 ; } 176int agggf ( float f ) ; 177int agggf ( float f ) ; // ERROR, second prototype 178 179varying struct SSS { float f ; } s ; // ERROR 180 181int vf ( void ) ; 182int vf2 () ; 183int vf3 ( void v ) ; // ERROR 184int vf4 ( int , void ) ; // ERROR 185int vf5 ( int , void v ) ; // ERROR 186 187void badswizzle () 188{ 189vec3 a [ 5 ] ; 190a . y ; // ERROR, no array swizzle 191a . zy ; // ERROR, no array swizzle 192a . nothing ; // ERROR 193a . length () ; // ERROR, not this version 194a . method () ; // ERROR 195} 196 197float fooinit () ; 198 199float fooinittest () 200{ 201return fooinit () ; 202} 203 204// Test extension GL_EXT_blend_func_extended 205void blendFuncFail () // Error since extension GL_EXT_blend_func_extended is disabled 206{ 207gl_SecondaryFragColorEXT = vec4 ( 1.0 ) ; 208gl_SecondaryFragDataEXT [ gl_MaxDualSourceDrawBuffersEXT - 1 ] = vec4 ( 0.1 ) ; 209} 210#extension GL_EXT_blend_func_extended : enable 211void blendFunc () 212{ 213gl_SecondaryFragColorEXT = vec4 ( 1.0 ) ; 214gl_SecondaryFragDataEXT [ gl_MaxDualSourceDrawBuffersEXT - 1 ] = vec4 ( 0.1 ) ; 215} 216 217// Test extra-function initializers 218const float fi1 = 3.0 ; 219const float fi2 = 4.0 ; 220const float fi3 = 5.0 ; 221 222float fooinit () 223{ 224return fi1 + fi2 + fi3 ; // should make a constant of 12.0 225} 226 227int init1 = gl_FrontFacing ? 1 : 2 ; // ERROR, non-const initializer 228 229#ifdef GL_EXT_shader_non_constant_global_initializers 230#extension GL_EXT_shader_non_constant_global_initializers : enable 231#endif 232 233int init2 = gl_FrontFacing ? 1 : 2 ; 234 235#define A__B // error 236int a__b ; // error 237 238#pragma STDGL invariant ( all ) 239 240#line 3000 241#error line of this error should be 3000 242 243uniform samplerExternalOES badExt ; // syntax ERROR