SPIRV-Cross/reference/opt/shaders-msl/asm/comp/variable-pointers-2.asm.comp

32 lines
712 B
Plaintext
Raw Normal View History

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct foo
{
int a[128];
uint b;
float2 c;
};
struct bar
{
int d;
};
kernel void main0(device foo& buf [[buffer(0)]], constant bar& cb [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]])
{
bool _70 = cb.d != 0;
for (device int* _52 = &(_70 ? &buf : nullptr)->a[0u], * _55 = &buf.a[0u]; (*_52) != (*_55); )
{
int _66 = ((*_52) + (*_55)) + int((*(_70 ? &gl_GlobalInvocationID : &gl_LocalInvocationID)).x);
*_52 = _66;
*_55 = _66;
_52 = &_52[1u];
_55 = &_55[1u];
continue;
}
}