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 N; 9 half4 I; 10 half4 NRef; 11 half4 colorGreen; 12 half4 colorRed; 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 float huge = float(((((1e+30h) * (1e+30h) < 0) ? 1 : -1) * (1.0h))); 23 float2 huge2 = faceforward(float2(1.0), float2(1e+30), float2(1e+30)); 24 float3 huge3 = faceforward(float3(1.0), float3(1e+30), float3(1e+30)); 25 float4 huge4 = faceforward(float4(1.0), float4(1e+30), float4(1e+30)); 26 half4 expectedPos = half4(float4(huge) + huge2.xxxx); 27 half4 expectedNeg = half4(huge3.xxxx + huge4.xxxx); 28 expectedPos = half4(1.0h, 2.0h, 3.0h, 4.0h); 29 expectedNeg = half4(-1.0h, -2.0h, -3.0h, -4.0h); 30 _out.sk_FragColor = ((((((((((_uniforms.NRef.x) * (_uniforms.I.x) < 0) ? 1 : -1) * (_uniforms.N.x)) == expectedNeg.x && all(faceforward(_uniforms.N.xy, _uniforms.I.xy, _uniforms.NRef.xy) == expectedNeg.xy)) && all(faceforward(_uniforms.N.xyz, _uniforms.I.xyz, _uniforms.NRef.xyz) == expectedPos.xyz)) && all(faceforward(_uniforms.N, _uniforms.I, _uniforms.NRef) == expectedPos)) && -1.0h == expectedNeg.x) && all(half2(-1.0h, -2.0h) == expectedNeg.xy)) && all(half3(1.0h, 2.0h, 3.0h) == expectedPos.xyz)) && all(half4(1.0h, 2.0h, 3.0h, 4.0h) == expectedPos) ? _uniforms.colorGreen : _uniforms.colorRed; 31 return _out; 32} 33