SPIRV-Cross/reference/shaders-msl-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp
Hans-Kristian Arntzen a0c13e4ee8 Do not consider aliased struct types if the master is not a block.
It is possible for a shader to declare two plain struct types which
simply share the same OpName without there being an implicit
value/buffer alias relationship.

For to_member_name(), make sure to use the type alias master when
resolving member names. The member name may be different in a type alias
master if the SPIR-V is being intentionally difficult.
2019-10-07 10:52:16 +02:00

39 lines
420 B
Plaintext

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct T
{
float a;
};
struct T_1
{
float b;
};
struct SSBO1
{
T_1 foo[1];
};
struct T_2
{
float c;
char _m0_final_padding[12];
};
struct SSBO2
{
T_2 bar[1];
};
kernel void main0(device SSBO1& _7 [[buffer(0)]], device SSBO2& _10 [[buffer(1)]])
{
T v = T{ 40.0 };
_7.foo[10].b = v.a;
_10.bar[30].c = v.a;
}