• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#include <metal_stdlib>
2#include <simd/simd.h>
3using namespace metal;
4struct Uniforms {
5    half4 testInputs;
6    half4 colorBlack;
7    half4 colorGreen;
8    half4 colorRed;
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    half4 _0_v = _uniforms.testInputs;
19    int4 _1_i = int4(_uniforms.colorBlack);
20    half _2_x = _0_v[_1_i.x];
21    half _3_y = _0_v[_1_i.y];
22    half _4_z = _0_v[_1_i.z];
23    half _5_w = _0_v[_1_i.w];
24    _out.sk_FragColor = all(half4(_2_x, _3_y, _4_z, _5_w) == half4(-1.25h, -1.25h, -1.25h, 0.0h)) ? _uniforms.colorGreen : _uniforms.colorRed;
25    return _out;
26}
27