xref: /aosp_15_r20/external/skia/tests/sksl/intrinsics/DFdy.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 testInputs;
9    half4 colorGreen;
10    half4 colorRed;
11};
12struct Inputs {
13};
14struct Outputs {
15    half4 sk_FragColor [[color(0)]];
16};
17struct sksl_synthetic_uniforms {
18    float2 u_skRTFlip;
19};
20fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], constant sksl_synthetic_uniforms& _anonInterface0 [[buffer(1)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
21    Outputs _out;
22    (void)_out;
23    half4 expected = half4(0.0h);
24    _out.sk_FragColor = ((((((_anonInterface0.u_skRTFlip.y * dfdy(_uniforms.testInputs.x)) == expected.x && all((_anonInterface0.u_skRTFlip.y * dfdy(_uniforms.testInputs.xy)) == expected.xy)) && all((_anonInterface0.u_skRTFlip.y * dfdy(_uniforms.testInputs.xyz)) == expected.xyz)) && all((_anonInterface0.u_skRTFlip.y * dfdy(_uniforms.testInputs)) == expected)) && all(sign((_anonInterface0.u_skRTFlip.y * dfdy(coords.xx))) == float2(0.0))) && all(sign((_anonInterface0.u_skRTFlip.y * dfdy(coords.yy))) == float2(1.0))) && all(sign((_anonInterface0.u_skRTFlip.y * dfdy(coords))) == float2(0.0, 1.0)) ? _uniforms.colorGreen : _uniforms.colorRed;
25    return _out;
26}
27