| #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 strided_arr { |
| /* 0x0000 */ float2 el; |
| /* 0x0008 */ tint_array<int8_t, 8> tint_pad; |
| }; |
| |
| #define TINT_ISOLATE_UB(VOLATILE_NAME) \ |
| {volatile bool VOLATILE_NAME = false; if (VOLATILE_NAME) break;} |
| |
| struct SSBO { |
| /* 0x0000 */ tint_array<strided_arr, 2> m; |
| }; |
| |
| struct tint_module_vars_struct { |
| device SSBO* ssbo; |
| }; |
| |
| tint_array<strided_arr, 2> mat2x2_stride_16_to_arr(float2x2 m) { |
| strided_arr const v = strided_arr{.el=m[0u]}; |
| return tint_array<strided_arr, 2>{v, strided_arr{.el=m[1u]}}; |
| } |
| |
| float2x2 arr_to_mat2x2_stride_16(tint_array<strided_arr, 2> arr) { |
| return float2x2(arr[0u].el, arr[1u].el); |
| } |
| |
| void tint_store_and_preserve_padding_1(device strided_arr* const target, strided_arr value_param) { |
| (*target).el = value_param.el; |
| } |
| |
| void tint_store_and_preserve_padding(device tint_array<strided_arr, 2>* const target, tint_array<strided_arr, 2> value_param) { |
| { |
| uint v_1 = 0u; |
| v_1 = 0u; |
| while(true) { |
| TINT_ISOLATE_UB(tint_volatile_false) |
| uint const v_2 = v_1; |
| if ((v_2 >= 2u)) { |
| break; |
| } |
| tint_store_and_preserve_padding_1((&(*target)[v_2]), value_param[v_2]); |
| { |
| v_1 = (v_2 + 1u); |
| } |
| continue; |
| } |
| } |
| } |
| |
| void f_1(tint_module_vars_struct tint_module_vars) { |
| tint_store_and_preserve_padding((&(*tint_module_vars.ssbo).m), mat2x2_stride_16_to_arr(arr_to_mat2x2_stride_16((*tint_module_vars.ssbo).m))); |
| } |
| |
| kernel void f(device SSBO* ssbo [[buffer(0)]]) { |
| tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.ssbo=ssbo}; |
| f_1(tint_module_vars); |
| } |