| 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 |
float4 in_data[1]; |
| 12 |
}; |
| 13 |
|
| 14 |
struct SSBO2 |
| 15 |
{ |
| 16 |
float4 out_data[1]; |
| 17 |
}; |
| 18 |
|
| 19 |
struct SSBO3 |
| 20 |
{ |
| 21 |
uint counter; |
| 22 |
}; |
| 23 |
|
| 24 |
constant uint _59_tmp [[function_constant(10)]]; |
| 25 |
constant uint _59 = is_function_constant_defined(_59_tmp) ? _59_tmp : 1u; |
| 26 |
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(_59, 1u, 1u); |
| 27 |
|
| 28 |
kernel void main0(const device SSBO& _27 [[buffer(0)]], device SSBO2& _49 [[buffer(1)]], device SSBO3& _52 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint3 spvDispatchBase [[grid_origin]]) |
| 29 |
{ |
| 30 |
gl_GlobalInvocationID += spvDispatchBase * gl_WorkGroupSize; |
| 31 |
gl_WorkGroupID += spvDispatchBase; |
| 32 |
uint ident = gl_GlobalInvocationID.x; |
| 33 |
uint workgroup = gl_WorkGroupID.x; |
| 34 |
float4 idata = _27.in_data[ident]; |
| 35 |
if (dot(idata, float4(1.0, 5.0, 6.0, 2.0)) > 8.19999980926513671875) |
| 36 |
{ |
| 37 |
uint _56 = atomic_fetch_add_explicit((device atomic_uint*)&_52.counter, 1u, memory_order_relaxed); |
| 38 |
_49.out_data[_56] = idata; |
| 39 |
} |
| 40 |
} |
| 41 |
|