34 lines
738 B
Plaintext
34 lines
738 B
Plaintext
#pragma clang diagnostic ignored "-Wunused-variable"
|
|
|
|
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
#include <metal_atomic>
|
|
|
|
using namespace metal;
|
|
|
|
struct SSBO
|
|
{
|
|
float4 in_data[1];
|
|
};
|
|
|
|
struct SSBO2
|
|
{
|
|
float4 out_data[1];
|
|
};
|
|
|
|
struct SSBO3
|
|
{
|
|
uint counter;
|
|
};
|
|
|
|
kernel void main0(device SSBO& _23 [[buffer(0)]], device SSBO2& _45 [[buffer(1)]], device SSBO3& _48 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
|
|
{
|
|
float4 _29 = _23.in_data[gl_GlobalInvocationID.x];
|
|
if (dot(_29, float4(1.0, 5.0, 6.0, 2.0)) > 8.19999980926513671875)
|
|
{
|
|
uint _52 = atomic_fetch_add_explicit((volatile device atomic_uint*)&(_48.counter), 1u, memory_order_relaxed);
|
|
_45.out_data[_52] = _29;
|
|
}
|
|
}
|
|
|