2019-01-17 13:29:09 +03:00
|
|
|
#include <metal_stdlib>
|
|
|
|
#include <simd/simd.h>
|
|
|
|
|
|
|
|
using namespace metal;
|
|
|
|
|
|
|
|
struct Sub
|
|
|
|
{
|
2019-05-23 15:54:04 +03:00
|
|
|
float f[2];
|
|
|
|
float2 f2[2];
|
2019-01-17 13:29:09 +03:00
|
|
|
float3 f3[2];
|
|
|
|
float4 f4[2];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Sub_1
|
|
|
|
{
|
2019-05-23 15:54:04 +03:00
|
|
|
float4 f[2];
|
|
|
|
float4 f2[2];
|
2019-01-17 13:29:09 +03:00
|
|
|
float3 f3[2];
|
|
|
|
float4 f4[2];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SSBO
|
|
|
|
{
|
2019-05-23 15:54:04 +03:00
|
|
|
Sub_1 sub[2];
|
2019-01-17 13:29:09 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
kernel void main0(device SSBO& _27 [[buffer(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
|
|
|
|
{
|
2019-05-23 15:54:04 +03:00
|
|
|
Sub foo;
|
2019-01-17 13:29:09 +03:00
|
|
|
foo.f[0] = _27.sub[gl_WorkGroupID.x].f[0].x;
|
|
|
|
foo.f[1] = _27.sub[gl_WorkGroupID.x].f[1].x;
|
|
|
|
foo.f2[0] = _27.sub[gl_WorkGroupID.x].f2[0].xy;
|
|
|
|
foo.f2[1] = _27.sub[gl_WorkGroupID.x].f2[1].xy;
|
|
|
|
foo.f3[0] = _27.sub[gl_WorkGroupID.x].f3[0];
|
|
|
|
foo.f3[1] = _27.sub[gl_WorkGroupID.x].f3[1];
|
|
|
|
foo.f4[0] = _27.sub[gl_WorkGroupID.x].f4[0];
|
|
|
|
foo.f4[1] = _27.sub[gl_WorkGroupID.x].f4[1];
|
|
|
|
foo.f[gl_GlobalInvocationID.x] += 1.0;
|
|
|
|
foo.f2[gl_GlobalInvocationID.x] += float2(2.0);
|
|
|
|
foo.f3[gl_GlobalInvocationID.x] += float3(3.0);
|
|
|
|
foo.f4[gl_GlobalInvocationID.x] += float4(4.0);
|
|
|
|
_27.sub[gl_WorkGroupID.x].f[0].x = foo.f[0];
|
|
|
|
_27.sub[gl_WorkGroupID.x].f[1].x = foo.f[1];
|
|
|
|
_27.sub[gl_WorkGroupID.x].f2[0].xy = foo.f2[0];
|
|
|
|
_27.sub[gl_WorkGroupID.x].f2[1].xy = foo.f2[1];
|
|
|
|
_27.sub[gl_WorkGroupID.x].f3[0] = foo.f3[0];
|
|
|
|
_27.sub[gl_WorkGroupID.x].f3[1] = foo.f3[1];
|
|
|
|
_27.sub[gl_WorkGroupID.x].f4[0] = foo.f4[0];
|
|
|
|
_27.sub[gl_WorkGroupID.x].f4[1] = foo.f4[1];
|
|
|
|
_27.sub[0].f[0].x += 5.0;
|
|
|
|
_27.sub[0].f2[1].xy += float2(5.0);
|
|
|
|
}
|
|
|
|
|