xref: /aosp_15_r20/external/skia/tests/sksl/shared/ConstantCompositeAccessViaDynamicIndex.metal (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1#include <metal_stdlib>
2#include <simd/simd.h>
3#ifdef __clang__
4#pragma clang diagnostic ignored "-Wall"
5#endif
6using namespace metal;
7constant const array<half, 2> globalArray = array<half, 2>{1.0h, 1.0h};
8constant const half2 globalVector = half2(1.0h);
9constant const half2x2 globalMatrix = half2x2(half2(1.0h, 1.0h), half2(1.0h, 1.0h));
10struct Inputs {
11};
12struct Outputs {
13    half4 sk_FragColor [[color(0)]];
14};
15struct Globals {
16    int zero;
17};
18fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
19    Globals _globals{0};
20    (void)_globals;
21    Outputs _out;
22    (void)_out;
23    const array<half, 2> localArray = array<half, 2>{0.0h, 1.0h};
24    const half2 localVector = half2(1.0h);
25    const half2x2 localMatrix = half2x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h));
26    _out.sk_FragColor = half4(globalArray[_globals.zero] * localArray[_globals.zero], globalVector[_globals.zero] * localVector[_globals.zero], globalMatrix[_globals.zero] * localMatrix[_globals.zero]);
27    return _out;
28}
29