SPIRV-Cross/reference/shaders-msl/asm/comp/global-parameter-name-alias.asm.comp
Hans-Kristian Arntzen d1479f871a MSL: Do not generate UnsafeArray<> for any array inside buffer objects.
This avoids a lot of huge code changes.
Arrays generally cannot be copied in and out of buffers, at least no
compiler frontend seems to do it.

Also avoids a lot of issues surrounding packed vectors and matrices.
2019-10-24 12:22:30 +02:00

34 lines
836 B
Plaintext

#pragma clang diagnostic ignored "-Wmissing-prototypes"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct ssbo
{
uint _data[1];
};
static inline __attribute__((always_inline))
void Load(thread const uint& size, const device ssbo& ssbo_1)
{
int byteAddrTemp = int(size >> uint(2));
uint4 data = uint4(ssbo_1._data[byteAddrTemp], ssbo_1._data[byteAddrTemp + 1], ssbo_1._data[byteAddrTemp + 2], ssbo_1._data[byteAddrTemp + 3]);
}
static inline __attribute__((always_inline))
void _main(thread const uint3& id, const device ssbo& ssbo_1)
{
uint param = 4u;
Load(param, ssbo_1);
}
kernel void main0(const device ssbo& ssbo_1 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
{
uint3 id = gl_GlobalInvocationID;
uint3 param = id;
_main(param, ssbo_1);
}