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