diff options
Diffstat (limited to 'src/mbgl/gl/attribute.hpp')
-rw-r--r-- | src/mbgl/gl/attribute.hpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/mbgl/gl/attribute.hpp b/src/mbgl/gl/attribute.hpp index ab97ada0f2..d5e8edfc70 100644 --- a/src/mbgl/gl/attribute.hpp +++ b/src/mbgl/gl/attribute.hpp @@ -7,6 +7,7 @@ #include <mbgl/util/variant.hpp> #include <cstddef> +#include <vector> #include <functional> namespace mbgl { @@ -244,16 +245,26 @@ public: using VariableBindings = IndexedTuple< TypeList<As...>, TypeList<optional<typename As::Type::VariableBinding>...>>; + using NamedLocations = std::vector<std::pair<const std::string, AttributeLocation>>; using Vertex = detail::Vertex<typename As::Type...>; template <class A> static constexpr std::size_t Index = TypeIndex<A, As...>::value; - static Locations locations(const ProgramID& id) { + static Locations bindLocations(const ProgramID& id) { return Locations { bindAttributeLocation(id, Index<As>, As::name())... }; } + template <class Program> + static Locations loadNamedLocations(const Program& program) { + return Locations{ program.attributeLocation(As::name())... }; + } + + static NamedLocations getNamedLocations(const Locations& locations) { + return NamedLocations{ { As::name(), locations.template get<As>() }... }; + } + template <class DrawMode> static Bindings allVariableBindings(const VertexBuffer<Vertex, DrawMode>& buffer) { return Bindings { As::Type::variableBinding(buffer, Index<As>)... }; |