blob: 5b3331d7a62ed9c9cd2fffc3e107cc79eb486072 [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<float2x3, 4>* a;
device float* s;
thread int* counter;
};
int i(tint_module_vars_struct tint_module_vars) {
(*tint_module_vars.counter) = ((*tint_module_vars.counter) + 1);
return (*tint_module_vars.counter);
}
kernel void f(const constant tint_array<float2x3, 4>* a [[buffer(0)]], device float* s [[buffer(1)]]) {
thread int counter = 0;
tint_module_vars_struct const tint_module_vars = {.a=a, .s=s, .counter=(&counter)};
const constant tint_array<float2x3, 4>* const p_a = tint_module_vars.a;
const constant float2x3* const p_a_i = (&(*p_a)[i(tint_module_vars)]);
const constant float3* const p_a_i_i = (&(*p_a_i)[i(tint_module_vars)]);
tint_array<float2x3, 4> const l_a = (*p_a);
float2x3 const l_a_i = (*p_a_i);
float3 const l_a_i_i = (*p_a_i_i);
(*tint_module_vars.s) = ((((*p_a_i_i)[0u] + l_a[0][0][0u]) + l_a_i[0][0u]) + l_a_i_i[0u]);
}