SPIRV-Cross/reference/opt/shaders-msl/asm/comp/block-name-alias-global.asm.comp
Hans-Kristian Arntzen 9728f9c1b7 Use correct block-name / other-name aliasing rules.
A block name cannot alias with any name in its own scope,
and it cannot alias with any other "global" name.

To solve this, we need to complicate the name cache updates a little bit
where we have a "primary" namespace and "secondary" namespace.
2019-01-04 15:02:54 +01:00

46 lines
794 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
{
A_2 Data[1024];
};
struct B
{
A Data[1];
};
struct B_1
{
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;
}