Files
filament/third_party/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-2.asm.comp
2025-02-27 14:22:41 -05:00

64 lines
1.4 KiB
Plaintext

#pragma clang diagnostic ignored "-Wmissing-prototypes"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct foo
{
int a[128];
uint b;
float2 c;
};
struct bar
{
int d;
};
static inline __attribute__((always_inline))
device foo* select_buffer(device foo& a, constant bar& cb)
{
return (cb.d != 0) ? &a : nullptr;
}
static inline __attribute__((always_inline))
thread uint3* select_input(thread uint3& gl_GlobalInvocationID, thread uint3& gl_LocalInvocationID, constant bar& cb)
{
return (cb.d != 0) ? &gl_GlobalInvocationID : &gl_LocalInvocationID;
}
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]])
{
device foo* _44 = select_buffer(buf, cb);
device foo* _65 = _44;
thread uint3* _45 = select_input(gl_GlobalInvocationID, gl_LocalInvocationID, cb);
device foo* _66 = _65;
device int* _49;
device int* _52;
_49 = &_66->a[0u];
_52 = &buf.a[0u];
int _54;
int _55;
for (;;)
{
_54 = *_49;
_55 = *_52;
if (_54 != _55)
{
int _63 = (_54 + _55) + int((*_45).x);
*_49 = _63;
*_52 = _63;
_49 = &_49[1u];
_52 = &_52[1u];
continue;
}
else
{
break;
}
}
}