• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#pragma clang diagnostic ignored "-Wmissing-prototypes"
2
3#include <metal_stdlib>
4#include <simd/simd.h>
5
6using namespace metal;
7
8struct cb5_struct
9{
10    float4 _m0[5];
11};
12
13// Returns 2D texture coords corresponding to 1D texel buffer coords
14static inline __attribute__((always_inline))
15uint2 spvTexelBufferCoord(uint tc)
16{
17    return uint2(tc % 4096, tc / 4096);
18}
19
20kernel void main0(constant cb5_struct& cb0_5 [[buffer(0)]], texture2d<uint, access::write> u0 [[texture(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]])
21{
22    float4 r0;
23    r0.x = as_type<float>(int(gl_LocalInvocationID.x) << 4);
24    r0.y = as_type<float>(int(gl_LocalInvocationID.x));
25    uint _44 = as_type<uint>(r0.x) >> 2u;
26    uint4 _51 = as_type<uint4>(cb0_5._m0[uint(as_type<int>(r0.y)) + 1u]);
27    u0.write(_51.xxxx, spvTexelBufferCoord(_44));
28    u0.write(_51.yyyy, spvTexelBufferCoord((_44 + 1u)));
29    u0.write(_51.zzzz, spvTexelBufferCoord((_44 + 2u)));
30    u0.write(_51.wwww, spvTexelBufferCoord((_44 + 3u)));
31}
32
33