summaryrefslogtreecommitdiff
path: root/src/mbgl/gl/attribute.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/gl/attribute.hpp')
-rw-r--r--src/mbgl/gl/attribute.hpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/mbgl/gl/attribute.hpp b/src/mbgl/gl/attribute.hpp
index 43e2c2d794..e23c4f9e47 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 {
@@ -241,16 +242,26 @@ public:
using VariableBindings = IndexedTuple<
TypeList<As...>,
TypeList<optional<typename As::VariableBinding>...>>;
+ using NamedLocations = std::vector<std::pair<const std::string, AttributeLocation>>;
using Vertex = detail::Vertex<As...>;
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::variableBinding(buffer, Index<As>)... };