| 1 |
#pragma clang diagnostic ignored "-Wmissing-prototypes" |
| 2 |
|
| 3 |
#include <metal_stdlib> |
| 4 |
#include <simd/simd.h> |
| 5 |
|
| 6 |
using namespace metal; |
| 7 |
|
| 8 |
struct SSBO |
| 9 |
{ |
| 10 |
uint size; |
| 11 |
float4 v[1]; |
| 12 |
}; |
| 13 |
|
| 14 |
struct SSBO1 |
| 15 |
{ |
| 16 |
float bz[1]; |
| 17 |
}; |
| 18 |
|
| 19 |
struct SSBO2 |
| 20 |
{ |
| 21 |
uint size2; |
| 22 |
float4 w[1]; |
| 23 |
}; |
| 24 |
|
| 25 |
struct SSBO3 |
| 26 |
{ |
| 27 |
float bz[1]; |
| 28 |
}; |
| 29 |
|
| 30 |
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); |
| 31 |
|
| 32 |
struct spvDescriptorSetBuffer0 |
| 33 |
{ |
| 34 |
device SSBO* v_16 [[id(0)]]; |
| 35 |
constant uint* spvBufferSizeConstants [[id(1)]]; |
| 36 |
}; |
| 37 |
|
| 38 |
struct spvDescriptorSetBuffer1 |
| 39 |
{ |
| 40 |
device SSBO1* ssbos [[id(0)]][2]; |
| 41 |
constant uint* spvBufferSizeConstants [[id(2)]]; |
| 42 |
}; |
| 43 |
|
| 44 |
static inline __attribute__((always_inline)) |
| 45 |
uint get_size(device SSBO& v_16, constant uint& v_16BufferSize, device SSBO1* constant (&ssbos)[2], constant uint* ssbosBufferSize, device SSBO2& v_38, constant uint& v_38BufferSize, device SSBO3* (&ssbos2)[2], constant uint* ssbos2BufferSize) |
| 46 |
{ |
| 47 |
uint len = uint(int((v_16BufferSize - 16) / 16)); |
| 48 |
len += uint(int((ssbosBufferSize[1] - 0) / 4)); |
| 49 |
len += uint(int((v_38BufferSize - 16) / 16)); |
| 50 |
len += uint(int((ssbos2BufferSize[0] - 0) / 4)); |
| 51 |
return len; |
| 52 |
} |
| 53 |
|
| 54 |
kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], constant uint* spvBufferSizeConstants [[buffer(25)]], device SSBO2& v_38 [[buffer(2)]], device SSBO3* ssbos2_0 [[buffer(3)]], device SSBO3* ssbos2_1 [[buffer(4)]]) |
| 55 |
{ |
| 56 |
device SSBO3* ssbos2[] = |
| 57 |
{ |
| 58 |
ssbos2_0, |
| 59 |
ssbos2_1, |
| 60 |
}; |
| 61 |
|
| 62 |
constant uint& spvDescriptorSet0_v_16BufferSize = spvDescriptorSet0.spvBufferSizeConstants[0]; |
| 63 |
constant uint* spvDescriptorSet1_ssbosBufferSize = &spvDescriptorSet1.spvBufferSizeConstants[0]; |
| 64 |
constant uint& v_38BufferSize = spvBufferSizeConstants[2]; |
| 65 |
constant uint* ssbos2BufferSize = &spvBufferSizeConstants[3]; |
| 66 |
(*spvDescriptorSet0.v_16).size = get_size((*spvDescriptorSet0.v_16), spvDescriptorSet0_v_16BufferSize, spvDescriptorSet1.ssbos, spvDescriptorSet1_ssbosBufferSize, v_38, v_38BufferSize, ssbos2, ssbos2BufferSize); |
| 67 |
} |
| 68 |
|