1/*#pragma settings NoInline*/ 2 3uniform half4 colorRed, colorGreen; 4 5struct S { float x; int y; }; 6 7struct Nested { S a, b; }; 8 9struct Compound { float4 f4; int3 i3; }; 10 11S returns_a_struct() { 12 S s; 13 s.x = 1; 14 s.y = 2; 15 return s; 16} 17 18S constructs_a_struct() { 19 return S(2, 3); 20} 21 22float accepts_a_struct(S s) { 23 return s.x + float(s.y); 24} 25 26void modifies_a_struct(inout S s) { 27 s.x++; 28 s.y++; 29} 30 31half4 main(float2 coords) { 32 S s = returns_a_struct(); 33 float x = accepts_a_struct(s); 34 modifies_a_struct(s); 35 36 S expected = constructs_a_struct(); 37 38 Nested n1, n2, n3; 39 n1.a = returns_a_struct(); 40 n1.b = n1.a; 41 n2 = n1; 42 n3 = n2; 43 modifies_a_struct(n3.b); 44 45 Compound c1 = Compound(float4(1, 2, 3, 4), int3(5, 6, 7)); 46 Compound c2 = Compound(float4(colorGreen.g, 2, 3, 4), int3(5, 6, 7)); 47 Compound c3 = Compound(float4(colorGreen.r, 2, 3, 4), int3(5, 6, 7)); 48 49 bool valid = (x == 3) && (s.x == 2) && (s.y == 3) && 50 (s == expected) && (s == S(2, 3)) && (s != returns_a_struct()) && 51 (n1 == n2) && (n1 != n3) && (n3 == Nested(S(1, 2), S(2, 3))) && 52 (c1 == c2) && (c2 != c3); 53 54 return valid ? colorGreen : colorRed; 55} 56