2019-05-27 09:59:29 +00:00
|
|
|
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
|
|
|
|
|
|
|
#include <metal_stdlib>
|
|
|
|
#include <simd/simd.h>
|
|
|
|
|
|
|
|
using namespace metal;
|
|
|
|
|
|
|
|
struct SSBO
|
|
|
|
{
|
|
|
|
uint size;
|
2019-10-24 10:22:30 +00:00
|
|
|
float4 v[1];
|
2019-05-27 09:59:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct SSBO1
|
|
|
|
{
|
2019-10-24 10:22:30 +00:00
|
|
|
float bz[1];
|
2019-05-27 09:59:29 +00:00
|
|
|
};
|
|
|
|
|
2019-09-24 22:13:04 +00:00
|
|
|
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
|
|
|
|
|
2019-09-17 19:11:19 +00:00
|
|
|
static inline __attribute__((always_inline))
|
2019-10-24 11:57:05 +00:00
|
|
|
uint get_size(device SSBO& v_14, constant uint& v_14BufferSize, device SSBO1* (&ssbos)[2], constant uint* ssbosBufferSize)
|
2019-05-27 09:59:29 +00:00
|
|
|
{
|
|
|
|
return uint(int((v_14BufferSize - 16) / 16) + int((ssbosBufferSize[1] - 0) / 4));
|
|
|
|
}
|
|
|
|
|
2019-09-24 22:13:04 +00:00
|
|
|
kernel void main0(constant uint* spvBufferSizeConstants [[buffer(25)]], device SSBO& v_14 [[buffer(0)]], device SSBO1* ssbos_0 [[buffer(1)]], device SSBO1* ssbos_1 [[buffer(2)]])
|
2019-05-27 09:59:29 +00:00
|
|
|
{
|
2019-10-24 11:57:05 +00:00
|
|
|
device SSBO1* ssbos[] =
|
2019-05-27 09:59:29 +00:00
|
|
|
{
|
|
|
|
ssbos_0,
|
|
|
|
ssbos_1,
|
|
|
|
};
|
|
|
|
|
2019-09-24 22:13:04 +00:00
|
|
|
constant uint& v_14BufferSize = spvBufferSizeConstants[0];
|
|
|
|
constant uint* ssbosBufferSize = &spvBufferSizeConstants[1];
|
2019-05-27 09:59:29 +00:00
|
|
|
v_14.size = get_size(v_14, v_14BufferSize, ssbos, ssbosBufferSize);
|
|
|
|
}
|
|
|
|
|