diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-10-10 15:58:04 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-10-28 17:14:07 -0700 |
commit | 39d5cb325012a5675676c81153c5e95d29fbc357 (patch) | |
tree | 214ad773048a0ae1e0492573ba9bb21716c4d881 /src/mbgl/gl/context.hpp | |
parent | 0e57d10d77e555a9229f7d522d83f87df7d5180d (diff) | |
download | qtlocation-mapboxgl-39d5cb325012a5675676c81153c5e95d29fbc357.tar.gz |
[core] Use VAOs internally
Diffstat (limited to 'src/mbgl/gl/context.hpp')
-rw-r--r-- | src/mbgl/gl/context.hpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp index 74c1bcba56..84c83f8d31 100644 --- a/src/mbgl/gl/context.hpp +++ b/src/mbgl/gl/context.hpp @@ -14,6 +14,7 @@ #include <memory> #include <vector> #include <array> +#include <unordered_map> namespace mbgl { @@ -31,7 +32,6 @@ public: UniqueShader createVertexShader(); UniqueShader createFragmentShader(); UniqueTexture createTexture(); - UniqueVertexArray createVertexArray(); template <class V> VertexBuffer<V> createVertexBuffer(std::vector<V>&& v) { @@ -174,6 +174,20 @@ private: std::vector<VertexArrayID> abandonedVertexArrays; std::vector<FramebufferID> abandonedFramebuffers; std::vector<RenderbufferID> abandonedRenderbuffers; + + using VertexArrayObjectKey = std::tuple< + ProgramID, // Program + BufferID, // Vertex buffer + BufferID, // Index buffer + std::size_t // Vertex buffer offset + >; + + struct VertexArrayObjectHash { + std::size_t operator()(const VertexArrayObjectKey&) const; + }; + + using VertexArrayObjectMap = std::unordered_map<VertexArrayObjectKey, UniqueVertexArray, VertexArrayObjectHash>; + VertexArrayObjectMap vaos; }; } // namespace gl |