yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
d8f5681e
vulkan-sdk-1.4.357.0
1#version 450 2 3struct S { 4int a ; 5} ; 6 7uniform ubuf { 8S s ; 9} ; 10 11uniform sampler2D s2d ; 12 13layout ( location = 0 ) in vec4 inv ; 14layout ( location = 0 ) out vec4 outv ; 15 16vec4 foo ( S s ) 17{ 18vec4 r = s . a * inv ; 19++ r ; 20if ( r . x > 3.0 ) 21-- r ; 22else 23r *= 2 ; 24 25return r ; 26} 27 28float testBranch ( float x , float y ) 29{ 30float result = 0 ; 31bool b = x > 0 ; 32 33// branch with load 34if ( b ) { 35result += 1 ; 36} 37else { 38result -= 1 ; 39} 40 41// branch with expression 42if ( x > y ) { 43result += x - y ; 44} 45 46// selection with load 47result += b ? 481 : - 1 ; 49 50// selection with expression 51result += x < y ? 52y : 53float ( b ) ; 54 55return result ; 56} 57 58void main () 59{ 60outv = foo ( s ) ; 61outv += testBranch ( inv . x , inv . y ) ; 62outv += texture ( s2d , vec2 ( 0.5 )) ; 63 64switch ( s . a ) { 65case 10 : 66++ outv ; 67break ; 68case 20 : 69outv = 2 * outv ; 70++ outv ; 71break ; 72default : 73-- outv ; 74break ; 75} 76 77for ( int i = 0 ; i < 10 ; ++ i ) 78outv *= 3.0 ; 79 80outv . x < 10.0 ? 81outv = sin ( outv ) : 82outv = cos ( outv ) ; 83}