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 colorBlack; 10 half4 colorGreen; 11 half4 colorRed; 12}; 13struct Inputs { 14}; 15struct Outputs { 16 half4 sk_FragColor [[color(0)]]; 17}; 18fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { 19 Outputs _out; 20 (void)_out; 21 half4 _0_v = _uniforms.testInputs; 22 int4 _1_i = int4(_uniforms.colorBlack); 23 half _2_x = _0_v[_1_i.x]; 24 half _3_y = _0_v[_1_i.y]; 25 half _4_z = _0_v[_1_i.z]; 26 half _5_w = _0_v[_1_i.w]; 27 _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; 28 return _out; 29} 30