• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#include <metal_stdlib>
2#include <simd/simd.h>
3using namespace metal;
4struct Inputs {
5    uint3 sk_GlobalInvocationID;
6};
7struct Globals {
8    texture2d<half, access::read> src;
9    texture2d<half, access::write> dest;
10};
11kernel void computeMain(uint3 sk_GlobalInvocationID [[thread_position_in_grid]], texture2d<half, access::read> src [[texture(0)]], texture2d<half, access::write> dest [[texture(1)]]) {
12    Globals _globals{src, dest};
13    (void)_globals;
14    Inputs _in = { sk_GlobalInvocationID };
15    if (_in.sk_GlobalInvocationID.x < _globals.src.get_width() && _in.sk_GlobalInvocationID.y < _globals.src.get_height()) {
16        half4 _0_color = _globals.src.read(_in.sk_GlobalInvocationID.xy);
17        _0_color.xyz = half3(dot(_0_color.xyz, half3(0.22h, 0.67h, 0.11h)));
18        _globals.dest.write(_0_color, _in.sk_GlobalInvocationID.xy);
19    }
20    return;
21}
22