• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#include <metal_stdlib>
2#include <simd/simd.h>
3using namespace metal;
4struct Uniforms {
5    float4 colorGreen;
6    float4 colorRed;
7};
8struct Inputs {
9};
10struct Outputs {
11    float4 sk_FragColor [[color(0)]];
12};
13float4 unpremul_h4h4(float4 color) {
14    return float4(color.xyz / max(color.w, 9.9999997473787516e-05), color.w);
15}
16
17float4 live_fn_h4h4h4(float4 a, float4 b) {
18    return a + b;
19}
20fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
21    Outputs _out;
22    (void)_out;
23    float4 a;
24    float4 b;
25    {
26        a = live_fn_h4h4h4(float4(3.0), float4(-5.0));
27    }
28    {
29        b = unpremul_h4h4(float4(1.0));
30    }
31    _out.sk_FragColor = any(a != float4(0.0)) && any(b != float4(0.0)) ? _uniforms.colorGreen : _uniforms.colorRed;
32    return _out;
33}
34