blob: 6ca01b6c6874694b2e9654335bf4d826e3ce379b [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 tint_module_vars_struct {
const constant tint_array<float4x4, 4>* u;
device float* s;
};
float a(tint_array<float4x4, 4> a) {
return a[0][0][0u];
}
float b(float4x4 m) {
return m[0][0u];
}
float c(float4 v) {
return v[0u];
}
float d(float f) {
return f;
}
kernel void f(const constant tint_array<float4x4, 4>* u [[buffer(0)]], device float* s [[buffer(1)]]) {
tint_module_vars_struct const tint_module_vars = {.u=u, .s=s};
float const v_1 = a((*tint_module_vars.u));
float const v_2 = (v_1 + b((*tint_module_vars.u)[1]));
float const v_3 = (v_2 + c((*tint_module_vars.u)[1][0].ywxz));
(*tint_module_vars.s) = (v_3 + d((*tint_module_vars.u)[1][0].ywxz[0u]));
}