Debian Codegraph @

third_party/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-store-forwarding.asm.comp

raw
1 #pragma clang diagnostic ignored "-Wmissing-prototypes"
2
3 #include <metal_stdlib>
4 #include <simd/simd.h>
5
6 using namespace metal;
7
8 struct foo
9 {
10 int a;
11 };
12
13 struct bar
14 {
15 int b;
16 };
17
18 static inline __attribute__((always_inline))
19 device int* _24(device foo& a, device bar& b, thread uint3& gl_GlobalInvocationID)
20 {
21 return (gl_GlobalInvocationID.x != 0u) ? &a.a : &b.b;
22 }
23
24 kernel void main0(device foo& x [[buffer(0)]], device bar& y [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
25 {
26 device int* _34 = _24(x, y, gl_GlobalInvocationID);
27 device int* _33 = _34;
28 int _37 = x.a;
29 *_33 = 0;
30 y.b = _37 + _37;
31 }
32