blob: 28c0c901679251dea887a0e9040c60fb95863f9c [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 S {
int before;
float2x2 m;
int after;
};
struct tint_module_vars_struct {
const constant tint_array<S, 4>* u;
thread tint_array<S, 4>* p;
};
kernel void f(const constant tint_array<S, 4>* u [[buffer(0)]]) {
thread tint_array<S, 4> p = {};
tint_module_vars_struct const tint_module_vars = {.u=u, .p=(&p)};
(*tint_module_vars.p) = (*tint_module_vars.u);
(*tint_module_vars.p)[1] = (*tint_module_vars.u)[2];
(*tint_module_vars.p)[3].m = (*tint_module_vars.u)[2].m;
(*tint_module_vars.p)[1].m[0] = (*tint_module_vars.u)[0].m[1].yx;
}