• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#include <metal_stdlib>
2#include <simd/simd.h>
3using namespace metal;
4struct Inputs {
5};
6struct Outputs {
7    float4 sk_FragColor [[color(0)]];
8};
9struct Globals {
10    float3x3 a;
11    float3x3 b;
12    float4x4 c;
13    float4x4 d;
14};
15
16template <int C, int R>
17matrix<float, C, R> matrixCompMult(matrix<float, C, R> a, matrix<float, C, R> b) {
18    matrix<float, C, R> result;
19    for (int c = 0; c < C; ++c) {
20        result[c] = a[c] * b[c];
21    }
22    return result;
23}
24fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
25    Globals _globals{{}, {}, {}, {}};
26    (void)_globals;
27    Outputs _out;
28    (void)_out;
29    _out.sk_FragColor.xyz = matrixCompMult(_globals.a, _globals.b)[0];
30    _out.sk_FragColor = matrixCompMult(_globals.c, _globals.d)[0];
31    return _out;
32}
33