| #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 { |
| /* 0x0000 */ float f; |
| /* 0x0004 */ uint u; |
| /* 0x0008 */ tint_array<int8_t, 120> tint_pad; |
| /* 0x0080 */ float4 v; |
| /* 0x0090 */ tint_array<int8_t, 16> tint_pad_1; |
| /* 0x00a0 */ half x; |
| /* 0x00a2 */ tint_array<int8_t, 30> tint_pad_2; |
| /* 0x00c0 */ packed_half3 y; |
| /* 0x00c6 */ tint_array<int8_t, 58> tint_pad_3; |
| }; |
| |
| void assign_and_preserve_padding(device S* const dest, S value) { |
| (*(dest)).f = value.f; |
| (*(dest)).u = value.u; |
| (*(dest)).v = value.v; |
| (*(dest)).x = value.x; |
| (*(dest)).y = half3(value.y); |
| } |
| |
| struct tint_symbol_1 { |
| float f [[user(locn0)]]; |
| uint u [[user(locn1)]] [[flat]]; |
| half x [[user(locn2)]]; |
| half3 y [[user(locn3)]]; |
| }; |
| |
| void frag_main_inner(S input, device S* const tint_symbol_3) { |
| float const f = input.f; |
| uint const u = input.u; |
| float4 const v = input.v; |
| half const x = input.x; |
| half3 const y = half3(input.y); |
| assign_and_preserve_padding(tint_symbol_3, input); |
| } |
| |
| fragment void frag_main(device S* tint_symbol_4 [[buffer(0)]], float4 v [[position]], tint_symbol_1 tint_symbol [[stage_in]]) { |
| S const tint_symbol_2 = {.f=tint_symbol.f, .u=tint_symbol.u, .v=v, .x=tint_symbol.x, .y=tint_symbol.y}; |
| frag_main_inner(tint_symbol_2, tint_symbol_4); |
| return; |
| } |
| |