52 lines
1.0 KiB
Plaintext
52 lines
1.0 KiB
Plaintext
#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 _71 = cb.d != 0;
|
|
device foo* _72 = _71 ? &buf : nullptr;
|
|
device foo* _67 = _72;
|
|
device foo* _65 = _72;
|
|
thread uint3* _79 = _71 ? &gl_GlobalInvocationID : &gl_LocalInvocationID;
|
|
thread uint3* _74 = _79;
|
|
device int* _49;
|
|
device int* _52;
|
|
_49 = &_72->a[0u];
|
|
_52 = &buf.a[0u];
|
|
int _54;
|
|
int _55;
|
|
for (;;)
|
|
{
|
|
_54 = *_49;
|
|
_55 = *_52;
|
|
if (_54 != _55)
|
|
{
|
|
int _63 = (_54 + _55) + int((*_79).x);
|
|
*_49 = _63;
|
|
*_52 = _63;
|
|
_49 = &_49[1u];
|
|
_52 = &_52[1u];
|
|
continue;
|
|
}
|
|
else
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|