diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2017-03-15 18:43:58 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2017-03-22 15:59:10 +0100 |
commit | 3c91b6b7de487993e75de552ba44249740644e42 (patch) | |
tree | 69b8b2642b3d8496657db92459b0a23e130b501d /src/mbgl/gl/uniform.hpp | |
parent | d20327844cac88b6bf42b201eac35e816a189a8a (diff) | |
download | qtlocation-mapboxgl-3c91b6b7de487993e75de552ba44249740644e42.tar.gz |
[core] cache binary shaders on Android
Diffstat (limited to 'src/mbgl/gl/uniform.hpp')
-rw-r--r-- | src/mbgl/gl/uniform.hpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/mbgl/gl/uniform.hpp b/src/mbgl/gl/uniform.hpp index 92136b61c2..34a32aeee9 100644 --- a/src/mbgl/gl/uniform.hpp +++ b/src/mbgl/gl/uniform.hpp @@ -6,6 +6,7 @@ #include <mbgl/util/indexed_tuple.hpp> #include <array> +#include <vector> #include <functional> namespace mbgl { @@ -66,11 +67,21 @@ public: using Types = TypeList<Us...>; using State = IndexedTuple<TypeList<Us...>, TypeList<typename Us::State...>>; using Values = IndexedTuple<TypeList<Us...>, TypeList<typename Us::Value...>>; + using NamedLocations = std::vector<std::pair<const std::string, UniformLocation>>; - static State state(const ProgramID& id) { + static State bindLocations(const ProgramID& id) { return State { { uniformLocation(id, Us::name()) }... }; } + template <class Program> + static State loadNamedLocations(const Program& program) { + return State{ { program.uniformLocation(Us::name()) }... }; + } + + static NamedLocations getNamedLocations(const State& state) { + return NamedLocations{ { Us::name(), state.template get<Us>().location }... }; + } + static void bind(State& state, Values&& values) { util::ignore({ (state.template get<Us>() = values.template get<Us>(), 0)... }); } |