1cb93a386Sopenharmony_ci#include <metal_stdlib>
2cb93a386Sopenharmony_ci#include <simd/simd.h>
3cb93a386Sopenharmony_ciusing namespace metal;
4cb93a386Sopenharmony_cistruct Uniforms {
5cb93a386Sopenharmony_ci    half4 colorGreen;
6cb93a386Sopenharmony_ci    half4 colorRed;
7cb93a386Sopenharmony_ci    half2x2 testMatrix2x2;
8cb93a386Sopenharmony_ci};
9cb93a386Sopenharmony_cistruct Inputs {
10cb93a386Sopenharmony_ci};
11cb93a386Sopenharmony_cistruct Outputs {
12cb93a386Sopenharmony_ci    half4 sk_FragColor [[color(0)]];
13cb93a386Sopenharmony_ci};
14cb93a386Sopenharmony_ci
15cb93a386Sopenharmony_cihalf4 half4_from_half2x2(half2x2 x) {
16cb93a386Sopenharmony_ci    return half4(x[0].xy, x[1].xy);
17cb93a386Sopenharmony_ci}
18cb93a386Sopenharmony_cifragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
19cb93a386Sopenharmony_ci    Outputs _out;
20cb93a386Sopenharmony_ci    (void)_out;
21cb93a386Sopenharmony_ci    bool ok = true;
22cb93a386Sopenharmony_ci    ok = ok && all(half4_from_half2x2(_uniforms.testMatrix2x2) == half4(1.0h, 2.0h, 3.0h, 4.0h));
23cb93a386Sopenharmony_ci    ok = ok && all(float4(half4_from_half2x2(_uniforms.testMatrix2x2)) == float4(1.0, 2.0, 3.0, 4.0));
24cb93a386Sopenharmony_ci    ok = ok && all(int4(half4_from_half2x2(_uniforms.testMatrix2x2)) == int4(1, 2, 3, 4));
25cb93a386Sopenharmony_ci    ok = ok && all(bool4(half4_from_half2x2(_uniforms.testMatrix2x2)) == bool4(true, true, true, true));
26cb93a386Sopenharmony_ci    _out.sk_FragColor = ok ? _uniforms.colorGreen : _uniforms.colorRed;
27cb93a386Sopenharmony_ci    return _out;
28cb93a386Sopenharmony_ci}
29