1#include <metal_stdlib> 2#include <simd/simd.h> 3#ifdef __clang__ 4#pragma clang diagnostic ignored "-Wall" 5#endif 6using namespace metal; 7struct S { 8 int i; 9}; 10struct Uniforms { 11 half4 colorGreen; 12 half4 colorRed; 13}; 14struct Inputs { 15}; 16struct Outputs { 17 half4 sk_FragColor [[color(0)]]; 18}; 19half4 fnGreen_h4bf2(Uniforms _uniforms, bool b, float2 ) { 20 return _uniforms.colorGreen; 21} 22half4 fnRed_h4ifS(Uniforms _uniforms, int , float f, S ) { 23 return _uniforms.colorRed; 24} 25fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { 26 Outputs _out; 27 (void)_out; 28 _out.sk_FragColor = bool(_uniforms.colorGreen.y) ? fnGreen_h4bf2(_uniforms, true, coords) : fnRed_h4ifS(_uniforms, 123, 3.14, S{0}); 29 return _out; 30} 31