1/*#pragma settings NoInline*/
2
3uniform half4 colorGreen, colorRed, colorWhite;
4
5void out_half (out half  v) { v = colorWhite.r; }
6void out_half2(out half2 v) { v = half2(colorWhite.g); }
7void out_half3(out half3 v) { v = half3(colorWhite.b); }
8void out_half4(out half4 v) { v = half4(colorWhite.a); }
9
10void out_half2x2(out half2x2 v) { v = half2x2(colorWhite.r); }
11void out_half3x3(out half3x3 v) { v = half3x3(colorWhite.g); }
12void out_half4x4(out half4x4 v) { v = half4x4(colorWhite.b); }
13
14void out_int (out int  v) { v = int(colorWhite.r); }
15void out_int2(out int2 v) { v = int2(colorWhite.g); }
16void out_int3(out int3 v) { v = int3(colorWhite.b); }
17void out_int4(out int4 v) { v = int4(colorWhite.a); }
18
19void out_float (out float  v) { v = float(colorWhite.r); }
20void out_float2(out float2 v) { v = float2(colorWhite.g); }
21void out_float3(out float3 v) { v = float3(colorWhite.b); }
22void out_float4(out float4 v) { v = float4(colorWhite.a); }
23
24void out_float2x2(out float2x2 v) { v = float2x2(colorWhite.r); }
25void out_float3x3(out float3x3 v) { v = float3x3(colorWhite.g); }
26void out_float4x4(out float4x4 v) { v = float4x4(colorWhite.b); }
27
28void out_bool (out bool  v) { v = bool(colorWhite.r); }
29void out_bool2(out bool2 v) { v = bool2(colorWhite.g); }
30void out_bool3(out bool3 v) { v = bool3(colorWhite.b); }
31void out_bool4(out bool4 v) { v = bool4(colorWhite.a); }
32
33half4 main(float2 coords) {
34    half4 result;
35
36    half     h;    out_half (h);
37    half2    h2;   out_half2(h2);
38    half3    h3;   out_half3(h3);
39    half4    h4;   out_half4(h4);
40                   out_half(h3[1]);
41                   out_half2(h3.xz);
42                   out_half4(h4.zwxy);
43
44    half2x2  h2x2; out_half2x2(h2x2);
45    half3x3  h3x3; out_half3x3(h3x3);
46    half4x4  h4x4; out_half4x4(h4x4);
47                   out_half3(h3x3[1]);
48                   out_half(h4x4[3].w);
49                   out_half(h2x2[0][0]);
50
51    int      i;    out_int (i);
52    int2     i2;   out_int2(i2);
53    int3     i3;   out_int3(i3);
54    int4     i4;   out_int4(i4);
55                   out_int3(i4.xyz);
56                   out_int(i2[1]);
57
58    float    f;    out_float (f);
59    float2   f2;   out_float2(f2);
60    float3   f3;   out_float3(f3);
61    float4   f4;   out_float4(f4);
62                   out_float2(f3.xy);
63                   out_float(f2[0]);
64
65    float2x2 f2x2; out_float2x2(f2x2);
66    float3x3 f3x3; out_float3x3(f3x3);
67    float4x4 f4x4; out_float4x4(f4x4);
68                   out_float(f2x2[0][0]);
69
70    bool     b;    out_bool (b);
71    bool2    b2;   out_bool2(b2);
72    bool3    b3;   out_bool3(b3);
73    bool4    b4;   out_bool4(b4);
74                   out_bool2(b4.xw);
75                   out_bool(b3[2]);
76
77    bool ok = true;
78    ok = ok && 1 == (h * h2.x * h3.x * h4.x * h2x2[0][0] * h3x3[0][0] * h4x4[0][0]);
79    ok = ok && 1 == (f * f2.x * f3.x * f4.x * f2x2[0][0] * f3x3[0][0] * f4x4[0][0]);
80    ok = ok && 1 == (i * i2.x * i3.x * i4.x);
81    ok = ok &&      (b && b2.x && b3.x && b4.x);
82
83    return ok ? colorGreen : colorRed;
84}
85