yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
3a4687d7
main-tot
1#version 300 es 2 3int f ( int a , int b , int c ) 4{ 5int a = b ; // ERROR, redefinition 6 7{ 8float a = float ( a ) + 1.0 ; 9} 10 11return a ; 12} 13 14int f ( int a , int b , int c ) ; // okay to redeclare 15 16bool b ; 17float b ( int a ) ; // ERROR: redefinition 18 19float c ( int a ) ; 20bool c ; // ERROR: redefinition 21 22float f ; // ERROR: redefinition 23float tan ; // ERROR: redefines built-in function 24float sin ( float x ) ; // ERROR: can't redefine built-in functions 25float cos ( float x ) // ERROR: can't redefine built-in functions 26{ 27return 1.0 ; 28} 29bool radians ( bool x ) // ERROR: can't overload built-in functions 30{ 31return true ; 32} 33 34invariant gl_Position ; 35 36void main () 37{ 38int g () ; // ERROR: no local function declarations 39g () ; 40 41float sin ; // okay 42sin ; 43sin ( 0.7 ) ; // ERROR, use of hidden function 44f ( 1 , 2 , 3 ) ; 45 46float f ; // hides f() 47f = 3.0 ; 48 49gl_Position = vec4 ( f ) ; 50 51for ( int f = 0 ; f < 10 ; ++ f ) 52++ f ; 53 54int x = 1 ; 55{ 56float x = 2.0 , /* 2nd x visible here */ y = x ; // y is initialized to 2 57int z = z ; // ERROR: z not previously defined. 58} 59{ 60int x = x ; // x is initialized to '1' 61} 62 63struct S 64{ 65int x ; 66} ; 67{ 68S S = S ( 0 ) ; // 'S' is only visible as a struct and constructor 69S . x ; // 'S' is now visible as a variable 70} 71 72int degrees ; 73degrees ( 3.2 ) ; // ERROR, use of hidden built-in function 74}