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