yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
bc17b0a9
vulkan-sdk-1.4.363.0
1#version 400 2 3uniform float u ; 4 5int foo ( int a , const int b , in int c , const in int d , out int e , inout int f ) 6{ 7int sum = a + b + c + d + f ; // no e, it is out only 8// sum should be 47 now 9 10a *= 64 ; 11// no b, it is read only 12c *= 64 ; 13// no d, it is read only 14e = 64 * 16 ; // e starts undefined 15f *= 64 ; 16 17sum += a + 64 * b + c + 64 * d + e + f ; // everything has a value now, totaling of 64(1+2+4+8+16+32) = 64*63 = 4032 18// sum should be 4032 + 47 = 4079 19 20return sum ; 21} 22 23int foo2 ( float a , vec3 b , out int r ) 24{ 25r = int ( 3.0 * a ) ; 26return int ( 5.0 * b . y ) ; 27} 28 29int foo3 () 30{ 31if ( u > 3.2 ) { 32discard ; 33return 1000000 ; 34} 35 36return 2000000 ; 37} 38 39void main () 40{ 41int e ; 42int t = 2 ; 43struct s { 44ivec4 t ; 45} f ; 46f . t . y = 32 ; 47 48// test the different qualifers 49int color = foo ( 1 , 2 , t + t , 8 , e , f . t . y ) ; 50 51color += 128 * ( e + f . t . y ) ; // right side should be 128(64(16 + 32)) = 393216 52// sum should be 4079 + 393216 = 397295 53 54// test conversions 55float arg ; 56float ret ; 57ret = foo2 ( 4 , ivec3 ( 1 , 2 , 3 ) , arg ) ; // ret = 10, param = 12.0 58color += int ( ret + arg ) ; // adds 22, for total of 397317 59 60color += foo3 () ; // theoretically, add 2000000, for total of 2397317 61 62gl_FragColor = vec4 ( color ) ; 63} 64 65vec3 m ( vec2 ) ; 66void aggCall () 67{ 68float F ; 69m ( ivec2 ( F )) ; // test input conversion of single argument that's an aggregate; other function tests in 120.vert 70} 71 72vec4 badConv () 73{ 74return u ; // ERROR, can change scalar to vector 75}