217eb5b5f9
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.
46 lines
958 B
Plaintext
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;
|
|
}
|
|
|