SPIRV-Cross/reference/opt/shaders-msl/asm/comp/block-name-alias-global.asm.comp
Hans-Kristian Arntzen 217eb5b5f9 MSL: Add a preliminary check for bad arrays of structs.
ArrayStride can be larger than the declared struct size.
We have no obvious solution for now, but warn about it in the MSL output
for the time being.
2019-01-28 15:20:30 +01:00

46 lines
958 B
Plaintext

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct A
{
int a;
int b;
};
struct A_1
{
A Data[1];
};
struct A_2
{
int a;
int b;
};
struct A_3
{
/* FIXME: A padded struct is needed here. If you see this message, file a bug! */ A_2 Data[1024];
};
struct B
{
A Data[1];
};
struct B_1
{
/* FIXME: A padded struct is needed here. If you see this message, file a bug! */ A_2 Data[1024];
};
kernel void main0(device B& C3 [[buffer(0)]], device A_1& C1 [[buffer(1)]], constant A_3& C2 [[buffer(2)]], constant B_1& C4 [[buffer(3)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
{
C1.Data[gl_GlobalInvocationID.x].a = C2.Data[gl_GlobalInvocationID.x].a;
C1.Data[gl_GlobalInvocationID.x].b = C2.Data[gl_GlobalInvocationID.x].b;
C3.Data[gl_GlobalInvocationID.x].a = C4.Data[gl_GlobalInvocationID.x].a;
C3.Data[gl_GlobalInvocationID.x].b = C4.Data[gl_GlobalInvocationID.x].b;
}