diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-02-18 11:19:24 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-02-18 15:15:24 -0800 |
commit | 9c26f063187b129218910dbb86eb21215a2cdf40 (patch) | |
tree | 189f84f90cef341a0a084fefde40f4f07da117cb /src/mbgl/geometry/vao.hpp | |
parent | 7b39ce95210ceb6640b3a3399dacd1d0e826ac1f (diff) | |
download | qtlocation-mapboxgl-9c26f063187b129218910dbb86eb21215a2cdf40.tar.gz |
[core] Thread GLObjectStore through to Holder objects
This eliminates the reliance on ThreadContext to provide GLObjectStore, and statically enforces that GL cleanup functions happen only when GLObjectStore::performCleanup is called.
With the elimination of the Map thread, this becomes important because there may be multiple GLObjectStore's per-thread, and Map will need to ensure that the correct context is active when calling GLObjectStore::performCleanup.
Diffstat (limited to 'src/mbgl/geometry/vao.hpp')
-rw-r--r-- | src/mbgl/geometry/vao.hpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mbgl/geometry/vao.hpp b/src/mbgl/geometry/vao.hpp index cab258cb5c..dcb66dd41d 100644 --- a/src/mbgl/geometry/vao.hpp +++ b/src/mbgl/geometry/vao.hpp @@ -20,10 +20,10 @@ public: ~VertexArrayObject(); template <typename Shader, typename VertexBuffer> - inline void bind(Shader& shader, VertexBuffer &vertexBuffer, GLbyte *offset) { - bindVertexArrayObject(); + inline void bind(Shader& shader, VertexBuffer &vertexBuffer, GLbyte *offset, gl::GLObjectStore& glObjectStore) { + bindVertexArrayObject(glObjectStore); if (bound_shader == 0) { - vertexBuffer.bind(); + vertexBuffer.bind(glObjectStore); shader.bind(offset); if (vao) { storeBinding(shader, vertexBuffer.getID(), 0, offset); @@ -34,11 +34,11 @@ public: } template <typename Shader, typename VertexBuffer, typename ElementsBuffer> - inline void bind(Shader& shader, VertexBuffer &vertexBuffer, ElementsBuffer &elementsBuffer, GLbyte *offset) { - bindVertexArrayObject(); + inline void bind(Shader& shader, VertexBuffer &vertexBuffer, ElementsBuffer &elementsBuffer, GLbyte *offset, gl::GLObjectStore& glObjectStore) { + bindVertexArrayObject(glObjectStore); if (bound_shader == 0) { - vertexBuffer.bind(); - elementsBuffer.bind(); + vertexBuffer.bind(glObjectStore); + elementsBuffer.bind(glObjectStore); shader.bind(offset); if (vao) { storeBinding(shader, vertexBuffer.getID(), elementsBuffer.getID(), offset); @@ -53,7 +53,7 @@ public: } private: - void bindVertexArrayObject(); + void bindVertexArrayObject(gl::GLObjectStore&); void storeBinding(Shader &shader, GLuint vertexBuffer, GLuint elementsBuffer, GLbyte *offset); void verifyBinding(Shader &shader, GLuint vertexBuffer, GLuint elementsBuffer, GLbyte *offset); |