xref: /aosp_15_r20/external/skia/tests/sksl/shared/GeometricIntrinsics.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};
10struct Inputs {
11};
12struct Outputs {
13    half4 sk_FragColor [[color(0)]];
14};
15fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
16    Outputs _out;
17    (void)_out;
18    float _0_x = 1.0;
19    _0_x = abs(_0_x);
20    _0_x = abs(_0_x - 2.0);
21    _0_x = (_0_x * 2.0);
22    _0_x = sign(_0_x);
23    float2 _1_x = float2(1.0, 2.0);
24    _1_x = float2(length(_1_x));
25    _1_x = float2(distance(_1_x, float2(3.0, 4.0)));
26    _1_x = float2(dot(_1_x, float2(3.0, 4.0)));
27    _1_x = normalize(_1_x);
28    _out.sk_FragColor = _uniforms.colorGreen;
29    return _out;
30}
31