1 2void Test1() 3{ 4 struct mystruct { float2 a; }; 5 mystruct test1 = { 6 { 1, 2, }, // test trailing commas in list 7 }; 8 9 mystruct test2 = { 10 float2(3, 4), 11 }; 12 13 // mystruct test3 = { 14 // { { 5, 6, } }, // TODO: test unneeded levels 15 // }; 16 17 float test4 = { 7, } ; // test scalar initialization 18 19 struct mystruct2 { float a; float b; float c; }; 20 mystruct2 test5 = { {8,}, {9,}, {10}, }; 21 const mystruct2 constTest5 = { {8,}, {9,}, {10}, }; 22 constTest5.c; 23 24 const float step = 1.f; 25 float n = 0; 26 const float3 a[8] = { 27 normalize(float3(1, 1, 1)) * (n += step), 28 normalize(float3(-1, -1, -1)) * (n += step), 29 normalize(float3(-1, -1, 1)) * (n += step), 30 normalize(float3(-1, 1, -1)) * (n += step), 31 normalize(float3(-1, 1, 1)) * (n += step), 32 normalize(float3(1, -1, -1)) * (n += step), 33 normalize(float3(1, -1, 1)) * (n += step), 34 normalize(float3(1, 1, -1)) * (n += step) }; 35 36 const struct one { float3 a; } oneNonConst = { normalize(float3(-1, 1, 1)) * (n += step) }; 37 const struct two { float3 a; 38 float3 b; } twoNonConst = { normalize(float3(-1, 1, 1)) * (n += step), 39 normalize(float3(-1, 1, 1)) * (n += step) }; 40} 41 42struct PS_OUTPUT { float4 color : SV_Target0; }; 43 44PS_OUTPUT main() 45{ 46 Test1(); 47 48 PS_OUTPUT ps_output; 49 ps_output.color = 1.0; 50 return ps_output; 51} 52