yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
1e275c84
main
1 2// array size from initializer 3static float g_array [ ] = { 1 , 2 , 3 , 4 , 5 } ; 4 5// Unused: array size from initializer 6static float g_array_unused [ ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 } ; 7 8// Test initializer sizing for arrayed structs 9static struct mystruct { 10int i ; 11float f ; 12} g_mystruct [] = { 13{ 1 , 2.0 } , 14{ 3 , 4.0 } , 15} ; 16 17struct PS_OUTPUT { float4 color : SV_Target0 ; } ; 18 19// INVALID: implicit size requires an initializer expression. 20// uniform float bad[]; 21 22// INVALID: function parameters cannot be implicitly sized 23// void BadFunction(int a[]) { } 24 25void main ( out PS_OUTPUT ps_output ) 26{ 27// local array sized from initializers 28float l_array [] = { 1 , 2 , 3 } ; 29int idx ; 30 31ps_output . color = g_array [ 0 ] + g_array [ 4 ] + l_array [ 1 ] + g_mystruct [ 0 ] . f + g_array [ idx ] ; 32}