Debian Codegraph @

third_party/spirv-cross/reference/shaders-msl/comp/shared.comp

raw
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 uint ident = gl_GlobalInvocationID.x;
22 float idata = _22.in_data[ident];
23 sShared[gl_LocalInvocationIndex] = idata;
24 threadgroup_barrier(mem_flags::mem_threadgroup);
25 _44.out_data[ident] = sShared[(4u - gl_LocalInvocationIndex) - 1u];
26 }
27