SPIRV-Cross/reference/shaders-hlsl/asm/comp/global-parameter-name-alias.asm.comp
Hans-Kristian Arntzen 87de951105 MSL: Fix naming issue of aliased global variables.
When the name of an alias global variable collides with a global
declaration, MSL would emit inconsistent names, sometimes with the
naming fix, sometimes without, because names were being tracked in two
separate meta blocks. Fix this by always redirecting parameter naming to
the original base variable as necessary.
2018-08-27 09:59:55 +02:00

34 lines
718 B
Plaintext

ByteAddressBuffer ssbo : register(t1);
static uint3 gl_GlobalInvocationID;
struct SPIRV_Cross_Input
{
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
};
void Load(uint size)
{
int byteAddrTemp = int(size >> uint(2));
uint4 data = uint4(ssbo.Load(byteAddrTemp * 4 + 0), ssbo.Load((byteAddrTemp + 1) * 4 + 0), ssbo.Load((byteAddrTemp + 2) * 4 + 0), ssbo.Load((byteAddrTemp + 3) * 4 + 0));
}
void _main(uint3 id)
{
uint param = 4u;
Load(param);
}
void comp_main()
{
uint3 id = gl_GlobalInvocationID;
uint3 param = id;
_main(param);
}
[numthreads(1, 1, 1)]
void main(SPIRV_Cross_Input stage_input)
{
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
comp_main();
}