2019-09-17 19:11:19 +00:00
|
|
|
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
2019-08-14 15:09:39 +00:00
|
|
|
#pragma clang diagnostic ignored "-Wmissing-braces"
|
|
|
|
|
2018-02-21 22:52:03 +00:00
|
|
|
#include <metal_stdlib>
|
|
|
|
#include <simd/simd.h>
|
|
|
|
|
|
|
|
using namespace metal;
|
|
|
|
|
2019-09-17 19:11:19 +00:00
|
|
|
template<typename T, size_t Num>
|
|
|
|
struct spvUnsafeArray
|
|
|
|
{
|
|
|
|
T elements[Num ? Num : 1];
|
|
|
|
|
|
|
|
thread T& operator [] (size_t pos) thread
|
|
|
|
{
|
|
|
|
return elements[pos];
|
|
|
|
}
|
|
|
|
constexpr const thread T& operator [] (size_t pos) const thread
|
|
|
|
{
|
|
|
|
return elements[pos];
|
|
|
|
}
|
|
|
|
|
|
|
|
device T& operator [] (size_t pos) device
|
|
|
|
{
|
|
|
|
return elements[pos];
|
|
|
|
}
|
|
|
|
constexpr const device T& operator [] (size_t pos) const device
|
|
|
|
{
|
|
|
|
return elements[pos];
|
|
|
|
}
|
|
|
|
|
|
|
|
constexpr const constant T& operator [] (size_t pos) const constant
|
|
|
|
{
|
|
|
|
return elements[pos];
|
|
|
|
}
|
|
|
|
|
|
|
|
threadgroup T& operator [] (size_t pos) threadgroup
|
|
|
|
{
|
|
|
|
return elements[pos];
|
|
|
|
}
|
|
|
|
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
|
|
|
|
{
|
|
|
|
return elements[pos];
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-02-21 22:52:03 +00:00
|
|
|
struct s1
|
|
|
|
{
|
|
|
|
int a;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct s2
|
|
|
|
{
|
|
|
|
s1 b;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct dstbuffer
|
|
|
|
{
|
2019-09-17 19:11:19 +00:00
|
|
|
spvUnsafeArray<s2, 1> test;
|
2018-02-21 22:52:03 +00:00
|
|
|
};
|
|
|
|
|
2019-06-21 10:44:33 +00:00
|
|
|
kernel void main0(device dstbuffer& _19 [[buffer(0)]])
|
2018-02-21 22:52:03 +00:00
|
|
|
{
|
2018-03-12 13:58:40 +00:00
|
|
|
_19.test[0].b.a = 0;
|
2018-02-21 22:52:03 +00:00
|
|
|
}
|
|
|
|
|