| 1 |
#include <metal_stdlib> |
| 2 |
#include <simd/simd.h> |
| 3 |
|
| 4 |
using namespace metal; |
| 5 |
|
| 6 |
typedef packed_float4 packed_float4x4[4]; |
| 7 |
|
| 8 |
struct Baz |
| 9 |
{ |
| 10 |
int f; |
| 11 |
int g; |
| 12 |
}; |
| 13 |
|
| 14 |
struct X |
| 15 |
{ |
| 16 |
int x; |
| 17 |
int y; |
| 18 |
float z; |
| 19 |
}; |
| 20 |
|
| 21 |
struct Foo |
| 22 |
{ |
| 23 |
int a; |
| 24 |
int b; |
| 25 |
packed_float4x4 c; |
| 26 |
X x[2]; |
| 27 |
}; |
| 28 |
|
| 29 |
struct Bar |
| 30 |
{ |
| 31 |
int d; |
| 32 |
int e; |
| 33 |
}; |
| 34 |
|
| 35 |
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(3u, 3u, 2u); |
| 36 |
|
| 37 |
struct spvDescriptorSetBuffer0 |
| 38 |
{ |
| 39 |
constant Bar* m_38 [[id(0)]]; |
| 40 |
Foo m_32 [[id(1)]]; |
| 41 |
}; |
| 42 |
|
| 43 |
struct spvDescriptorSetBuffer1 |
| 44 |
{ |
| 45 |
device Baz* baz [[id(0)]][3]; |
| 46 |
}; |
| 47 |
|
| 48 |
kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) |
| 49 |
{ |
| 50 |
spvDescriptorSet1.baz[gl_GlobalInvocationID.x]->f = spvDescriptorSet0.m_32.a + (*spvDescriptorSet0.m_38).d; |
| 51 |
spvDescriptorSet1.baz[gl_GlobalInvocationID.x]->g = spvDescriptorSet0.m_32.b * (*spvDescriptorSet0.m_38).e; |
| 52 |
} |
| 53 |
|