blob: 4200fee58429890e3553e9c346bec5d9b49eb1be [file] [log] [blame]
#include <metal_stdlib>
using namespace metal;
template<typename T, size_t N>
struct tint_array {
const constant T& operator[](size_t i) const constant { return elements[i]; }
device T& operator[](size_t i) device { return elements[i]; }
const device T& operator[](size_t i) const device { return elements[i]; }
thread T& operator[](size_t i) thread { return elements[i]; }
const thread T& operator[](size_t i) const thread { return elements[i]; }
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
T elements[N];
};
struct Outputs {
/* 0x0000 */ tint_array<uint, 1> data;
};
struct tint_module_vars_struct {
thread uint* count;
device Outputs* outputs;
};
void push_output(uint value, tint_module_vars_struct tint_module_vars) {
(*tint_module_vars.outputs).data[(*tint_module_vars.count)] = value;
(*tint_module_vars.count) = ((*tint_module_vars.count) + 1u);
}
kernel void tint_symbol(device Outputs* outputs [[buffer(0)]]) {
thread uint count = 0u;
tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.count=(&count), .outputs=outputs};
uint a = 0u;
uint b = 10u;
uint c = 4294967294u;
a = (a + 1u);
b = (b + 1u);
c = (c + 1u);
push_output(a, tint_module_vars);
push_output(b, tint_module_vars);
push_output(c, tint_module_vars);
}