xref: /aosp_15_r20/external/skia/tests/sksl/shared/OutParamsDoubleSwizzle.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;
7struct Uniforms {
8    half4 colorGreen;
9    half4 colorRed;
10};
11struct Inputs {
12};
13struct Outputs {
14    half4 sk_FragColor [[color(0)]];
15};
16half2 swizzle_lvalue_h2hhh2h(half x, half y, thread half2& color, half z) {
17    color.yx = color;
18    return half2(x + y, z);
19}
20void func_vh4(thread half4& color) {
21    half2 _skTemp0;
22    half2 _skTemp1;
23    half2 t = ((_skTemp1 = swizzle_lvalue_h2hhh2h(1.0h, 2.0h, (_skTemp0 = color.xz), 5.0h)), (color.xz = _skTemp0), _skTemp1);
24    color.yw = t;
25}
26fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
27    Outputs _out;
28    (void)_out;
29    half4 _skTemp2;
30    half4 result = half4(0.0h, 1.0h, 2.0h, 3.0h);
31    ((func_vh4((_skTemp2 = result))), (result = _skTemp2));
32    _out.sk_FragColor = all(result == half4(2.0h, 3.0h, 0.0h, 5.0h)) ? _uniforms.colorGreen : _uniforms.colorRed;
33    return _out;
34}
35