third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/variable-pointers-2.asm.comp
raw| 1 | #include <metal_stdlib> |
| 2 | #include <simd/simd.h> |
| 3 | |
| 4 | using namespace metal; |
| 5 | |
| 6 | struct foo |
| 7 | { |
| 8 | int a[128]; |
| 9 | uint b; |
| 10 | float2 c; |
| 11 | }; |
| 12 | |
| 13 | struct bar |
| 14 | { |
| 15 | int d; |
| 16 | }; |
| 17 | |
| 18 | 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]]) |
| 19 | { |
| 20 | bool _71 = cb.d != 0; |
| 21 | device foo* _72 = _71 ? &buf : nullptr; |
| 22 | device foo* _67 = _72; |
| 23 | device foo* _45 = _72; |
| 24 | thread uint3* _79 = _71 ? &gl_GlobalInvocationID : &gl_LocalInvocationID; |
| 25 | thread uint3* _74 = _79; |
| 26 | device int* _52; |
| 27 | device int* _55; |
| 28 | _52 = &_72->a[0u]; |
| 29 | _55 = &buf.a[0u]; |
| 30 | int _57; |
| 31 | int _58; |
| 32 | for (;;) |
| 33 | { |
| 34 | _57 = *_52; |
| 35 | _58 = *_55; |
| 36 | if (_57 != _58) |
| 37 | { |
| 38 | int _66 = (_57 + _58) + int((*_79).x); |
| 39 | *_52 = _66; |
| 40 | *_55 = _66; |
| 41 | _52 = &_52[1u]; |
| 42 | _55 = &_55[1u]; |
| 43 | continue; |
| 44 | } |
| 45 | else |
| 46 | { |
| 47 | break; |
| 48 | } |
| 49 | } |
| 50 | } |
| 51 |