| #include <metal_stdlib> |
| using namespace metal; |
| |
| struct Output { |
| float4 Position; |
| float4 color; |
| }; |
| |
| 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_symbol_outputs { |
| float4 Output_Position [[position]]; |
| float4 Output_color [[user(locn0)]]; |
| }; |
| |
| Output tint_symbol_inner(uint VertexIndex, uint InstanceIndex) { |
| tint_array<float2, 4> const zv = tint_array<float2, 4>{float2(0.20000000298023223877f), float2(0.30000001192092895508f), float2(-0.10000000149011611938f), float2(1.10000002384185791016f)}; |
| float const z = zv[InstanceIndex][0u]; |
| Output output = {}; |
| output.Position = float4(0.5f, 0.5f, z, 1.0f); |
| tint_array<float4, 4> const colors = tint_array<float4, 4>{float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f)}; |
| output.color = colors[InstanceIndex]; |
| return output; |
| } |
| |
| vertex tint_symbol_outputs tint_symbol(uint VertexIndex [[vertex_id]], uint InstanceIndex [[instance_id]]) { |
| Output const v = tint_symbol_inner(VertexIndex, InstanceIndex); |
| tint_symbol_outputs tint_wrapper_result = {}; |
| tint_wrapper_result.Output_Position = v.Position; |
| tint_wrapper_result.Output_color = v.color; |
| return tint_wrapper_result; |
| } |