yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
b4e66d7b
main
1#version 400 2 3struct Inner { 4int id ; 5float value ; 6}; 7 8struct Outer { 9int before ; 10uint padding ; 11mat2 matrix ; 12int after ; 13}; 14 15struct Complex { 16Inner nested ; 17Inner array [2 ]; 18}; 19 20struct Point { 21float x ; 22float y ; 23}; 24 25struct Color { 26vec3 rgb ; 27float alpha ; 28}; 29 30void store_data (Inner data [4 ]) { 31// Function that takes array of structs 32} 33 34void store_outer (Outer value ) { 35// Function that takes single struct 36} 37 38void process_point (Point p ) { 39// Function that takes single struct 40} 41 42void main () { 43// Pattern 1: Complex array constructors (most common tint failure pattern) 44Outer data [4 ]= Outer [4 ]( 45Outer (0 ,0u ,mat2 (vec2 (0.0 ),vec2 (0.0 )),0 ), 46Outer (1 ,1u ,mat2 (vec2 (1.0 ),vec2 (1.0 )),1 ), 47Outer (2 ,2u ,mat2 (vec2 (2.0 ),vec2 (2.0 )),2 ), 48Outer (3 ,3u ,mat2 (vec2 (3.0 ),vec2 (3.0 )),3 ) 49 ); 50 51// Pattern 2: Nested struct array constructors 52Inner inner_array [4 ]= Inner [4 ]( 53Inner (0 ,0.0 ), 54Inner (1 ,1.0 ), 55Inner (2 ,2.0 ), 56Inner (3 ,3.0 ) 57 ); 58 59// Pattern 3: Struct with nested struct constructors 60Complex complex_data = Complex ( 61Inner (42 ,3.14 ), 62Inner [2 ](Inner (1 ,1.0 ),Inner (2 ,2.0 )) 63 ); 64 65// Pattern 4: Function calls with array constructors 66store_data (Inner [4 ](Inner (1 ,1.0 ),Inner (2 ,2.0 ),Inner (3 ,3.0 ),Inner (4 ,4.0 ))); 67store_outer (Outer (10 ,10u ,mat2 (vec2 (5.0 ),vec2 (6.0 )),20 )); 68 69// Pattern 5: Basic struct constructors (from deleted basic_struct_constructor.frag) 70Point p1 = Point (1.0 ,2.0 ); 71Color c1 = Color (vec3 (1.0 ,0.0 ,0.0 ),1.0 ); 72Point p2 ; 73p2 = Point (3.0 ,4.0 ); 74 75// Pattern 6: Struct constructors in function calls (from deleted struct_constructor_in_function_call.frag) 76process_point (Point (5.0 ,6.0 )); 77}