| 1 |
#include <metal_stdlib> |
| 2 |
#include <simd/simd.h> |
| 3 |
|
| 4 |
using namespace metal; |
| 5 |
|
| 6 |
struct SSBO |
| 7 |
{ |
| 8 |
float in_data[1]; |
| 9 |
}; |
| 10 |
|
| 11 |
struct SSBO2 |
| 12 |
{ |
| 13 |
float out_data[1]; |
| 14 |
}; |
| 15 |
|
| 16 |
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); |
| 17 |
|
| 18 |
kernel void main0(const device SSBO& _22 [[buffer(0)]], device SSBO2& _44 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) |
| 19 |
{ |
| 20 |
threadgroup float sShared[4]; |
| 21 |
sShared[gl_LocalInvocationIndex] = _22.in_data[gl_GlobalInvocationID.x]; |
| 22 |
threadgroup_barrier(mem_flags::mem_threadgroup); |
| 23 |
_44.out_data[gl_GlobalInvocationID.x] = sShared[3u - gl_LocalInvocationIndex]; |
| 24 |
} |
| 25 |
|