39 lines
654 B
Plaintext
39 lines
654 B
Plaintext
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
|
|
|
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
using namespace metal;
|
|
|
|
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
|
|
|
|
static inline __attribute__((always_inline))
|
|
void set_f(thread int& f)
|
|
{
|
|
f = 40;
|
|
}
|
|
|
|
static inline __attribute__((always_inline))
|
|
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;
|
|
}
|
|
}
|
|
|