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