xref: /aosp_15_r20/external/skia/tests/sksl/intrinsics/MixFloatES3.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    half4 colorBlack;
11    half4 colorWhite;
12    half4 testInputs;
13};
14struct Inputs {
15};
16struct Outputs {
17    half4 sk_FragColor [[color(0)]];
18};
19fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
20    Outputs _out;
21    (void)_out;
22    bool4 FTFT = bool4(_uniforms.colorGreen);
23    bool4 TFTF = FTFT.wzyx;
24    _out.sk_FragColor = ((((((select(_uniforms.colorBlack.x, _uniforms.colorWhite.x, FTFT.x) == _uniforms.colorBlack.x && all(select(_uniforms.colorBlack.xy, _uniforms.colorWhite.xy, FTFT.xy) == half2(_uniforms.colorBlack.x, 1.0h))) && all(select(_uniforms.colorBlack.xyz, _uniforms.colorWhite.xyz, FTFT.xyz) == half3(_uniforms.colorBlack.x, 1.0h, _uniforms.colorBlack.z))) && all(select(_uniforms.colorBlack, _uniforms.colorWhite, FTFT) == half4(_uniforms.colorBlack.x, 1.0h, _uniforms.colorBlack.z, 1.0h))) && select(_uniforms.colorWhite.x, _uniforms.testInputs.x, TFTF.x) == _uniforms.testInputs.x) && all(select(_uniforms.colorWhite.xy, _uniforms.testInputs.xy, TFTF.xy) == half2(_uniforms.testInputs.x, 1.0h))) && all(select(_uniforms.colorWhite.xyz, _uniforms.testInputs.xyz, TFTF.xyz) == half3(_uniforms.testInputs.x, 1.0h, _uniforms.testInputs.z))) && all(select(_uniforms.colorWhite, _uniforms.testInputs, TFTF) == half4(_uniforms.testInputs.x, 1.0h, _uniforms.testInputs.z, 1.0h)) ? _uniforms.colorGreen : _uniforms.colorRed;
25    return _out;
26}
27