summaryrefslogtreecommitdiff
path: root/src/mbgl/gl/attribute.hpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-03-15 18:43:58 +0100
committerKonstantin Käfer <mail@kkaefer.com>2017-03-22 15:59:10 +0100
commit3c91b6b7de487993e75de552ba44249740644e42 (patch)
tree69b8b2642b3d8496657db92459b0a23e130b501d /src/mbgl/gl/attribute.hpp
parentd20327844cac88b6bf42b201eac35e816a189a8a (diff)
downloadqtlocation-mapboxgl-3c91b6b7de487993e75de552ba44249740644e42.tar.gz
[core] cache binary shaders on Android
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 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>)... };