SPIRV-Cross/reference/shaders-msl/asm/comp/block-name-alias-global.asm.comp
Hans-Kristian Arntzen e2c95bdcbc MSL: Rewrite how resource indices are fallback-assigned.
We used to use the Binding decoration for this, but this method is
hopelessly broken. If no explicit MSL resource remapping exists, we
remap automatically in a manner which should always "just work".
2019-06-21 12:54:08 +02: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 A_1& C1 [[buffer(0)]], constant A_3& C2 [[buffer(1)]], device B& C3 [[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;
}