• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#include <metal_stdlib>
2#include <simd/simd.h>
3using namespace metal;
4struct Uniforms {
5    float2 ah;
6    float2 bh;
7    float2 af;
8    float2 bf;
9};
10struct Inputs {
11};
12struct Outputs {
13    float4 sk_FragColor [[color(0)]];
14};
15float cross_hh2h2(float2 a, float2 b) {
16    return a.x * b.y - a.y * b.x;
17}
18float cross_ff2f2(float2 a, float2 b) {
19    return a.x * b.y - a.y * b.x;
20}
21
22fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
23    Outputs _out;
24    (void)_out;
25    _out.sk_FragColor.x = cross_hh2h2(_uniforms.ah, _uniforms.bh);
26    _out.sk_FragColor.y = cross_ff2f2(_uniforms.af, _uniforms.bf);
27    return _out;
28}
29