• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#include <metal_stdlib>
2#include <simd/simd.h>
3using namespace metal;
4struct Uniforms {
5    half4 colorGreen;
6    half4 colorRed;
7};
8struct Inputs {
9};
10struct Outputs {
11    half4 sk_FragColor [[color(0)]];
12};
13float _skOutParamHelper0_frexp(float _var0, thread int4& exp) {
14    int _var1;
15    float _skResult = frexp(_var0, _var1);
16    exp.x = _var1;
17    return _skResult;
18}
19float2 _skOutParamHelper1_frexp(float2 _var0, thread int4& exp) {
20    int2 _var1;
21    float2 _skResult = frexp(_var0, _var1);
22    exp.xy = _var1;
23    return _skResult;
24}
25float3 _skOutParamHelper2_frexp(float3 _var0, thread int4& exp) {
26    int3 _var1;
27    float3 _skResult = frexp(_var0, _var1);
28    exp.xyz = _var1;
29    return _skResult;
30}
31float4 _skOutParamHelper3_frexp(float4 _var0, thread int4& exp) {
32    int4 _var1;
33    float4 _skResult = frexp(_var0, _var1);
34    exp = _var1;
35    return _skResult;
36}
37fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
38    Outputs _out;
39    (void)_out;
40    float4 value = float4(_uniforms.colorGreen.yyyy * 6.0h);
41    int4 exp;
42    float4 result;
43    bool4 ok;
44    result.x =     _skOutParamHelper0_frexp(value.x, exp);
45    ok.x = result.x == 0.75 && exp.x == 3;
46    result.xy =     _skOutParamHelper1_frexp(value.xy, exp);
47    ok.y = result.y == 0.75 && exp.y == 3;
48    result.xyz =     _skOutParamHelper2_frexp(value.xyz, exp);
49    ok.z = result.z == 0.75 && exp.z == 3;
50    result =     _skOutParamHelper3_frexp(value, exp);
51    ok.w = result.w == 0.75 && exp.w == 3;
52    _out.sk_FragColor = all(ok) ? _uniforms.colorGreen : _uniforms.colorRed;
53    return _out;
54}
55