#pragma clang diagnostic ignored "-Wmissing-prototypes" | |
#include <metal_stdlib> | |
#include <simd/simd.h> | |
using namespace metal; | |
void set_f(thread int& f) | |
{ | |
f = 40; | |
} | |
void set_shared_u(threadgroup int& u) | |
{ | |
u = 50; | |
} | |
kernel void main0(uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) | |
{ | |
threadgroup int u; | |
int f; | |
set_f(f); | |
set_shared_u(u); | |
if (gl_LocalInvocationIndex == 0u) | |
{ | |
f = 10; | |
} | |
else | |
{ | |
f = 30; | |
u = 20; | |
} | |
} | |