| 1 |
#pragma clang diagnostic ignored "-Wunused-variable" |
| 2 |
|
| 3 |
#include <metal_stdlib> |
| 4 |
#include <simd/simd.h> |
| 5 |
#include <metal_atomic> |
| 6 |
|
| 7 |
using namespace metal; |
| 8 |
|
| 9 |
struct SSBO |
| 10 |
{ |
| 11 |
uint count; |
| 12 |
uint data[1]; |
| 13 |
}; |
| 14 |
|
| 15 |
kernel void main0(device SSBO& _5 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) |
| 16 |
{ |
| 17 |
uint _24 = atomic_fetch_add_explicit((device atomic_uint*)&_5.count, 1u, memory_order_relaxed); |
| 18 |
if (_24 < 1024u) |
| 19 |
{ |
| 20 |
_5.data[_24] = gl_GlobalInvocationID.x; |
| 21 |
} |
| 22 |
} |
| 23 |
|