• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#include <metal_stdlib>
2#include <simd/simd.h>
3using namespace metal;
4struct Uniforms {
5    float4 testInputs;
6    float4 colorGreen;
7    float4 colorRed;
8};
9struct Inputs {
10};
11struct Outputs {
12    float4 sk_FragColor [[color(0)]];
13};
14
15fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
16    Outputs _out;
17    (void)_out;
18    float4 v = _uniforms.testInputs;
19    v = float4(v.x, 1.0, 1.0, 1.0);
20    v = float4(v.xy, 1.0, 1.0);
21    v = float4(v.x, 1.0, 1.0, 1.0);
22    v = float4(0.0, v.y, 1.0, 1.0);
23    v = float4(v.xyz, 1.0);
24    v = float4(v.xy, 1.0, 1.0);
25    v = float4(v.x, 0.0, v.z, 1.0);
26    v = float4(v.x, 1.0, 0.0, 1.0);
27    v = float4(1.0, v.yz, 1.0);
28    v = float4(0.0, v.y, 1.0, 1.0);
29    v = float4(1.0, 1.0, v.z, 1.0);
30    v = float4(v.xyz, 1.0);
31    v = float4(v.xy, 0.0, v.w);
32    v = float4(v.xy, 1.0, 0.0);
33    v = float4(v.x, 1.0, v.zw);
34    v = float4(v.x, 0.0, v.z, 1.0);
35    v = float4(v.x, 1.0, 1.0, v.w);
36    v = float4(v.x, 1.0, 0.0, 1.0);
37    v = float4(1.0, v.yzw);
38    v = float4(0.0, v.yz, 1.0);
39    v = float4(0.0, v.y, 1.0, v.w);
40    v = float4(1.0, v.y, 1.0, 1.0);
41    v = float4(0.0, 0.0, v.zw);
42    v = float4(0.0, 0.0, v.z, 1.0);
43    v = float4(0.0, 1.0, 1.0, v.w);
44    _out.sk_FragColor = all(v == float4(0.0, 1.0, 1.0, 1.0)) ? _uniforms.colorGreen : _uniforms.colorRed;
45    return _out;
46}
47