diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2016-09-27 17:52:14 +0200 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-09-27 11:03:29 -0700 |
commit | 44c7e9d05edbe6fee9e8f98b91380b6c07e57ac7 (patch) | |
tree | cb2ee7fed51efe737543bb6f2444fac885571c41 /src/mbgl/geometry | |
parent | ce42d22984d19fa020e6fba77e2585c0fd9dacf4 (diff) | |
download | qtlocation-mapboxgl-44c7e9d05edbe6fee9e8f98b91380b6c07e57ac7.tar.gz |
[core] merge gl::ObjectStore into gl::Context
Diffstat (limited to 'src/mbgl/geometry')
-rw-r--r-- | src/mbgl/geometry/buffer.hpp | 9 | ||||
-rw-r--r-- | src/mbgl/geometry/line_atlas.cpp | 9 | ||||
-rw-r--r-- | src/mbgl/geometry/line_atlas.hpp | 7 | ||||
-rw-r--r-- | src/mbgl/geometry/vao.cpp | 5 | ||||
-rw-r--r-- | src/mbgl/geometry/vao.hpp | 15 |
5 files changed, 20 insertions, 25 deletions
diff --git a/src/mbgl/geometry/buffer.hpp b/src/mbgl/geometry/buffer.hpp index cfa96b8fed..8e58af8927 100644 --- a/src/mbgl/geometry/buffer.hpp +++ b/src/mbgl/geometry/buffer.hpp @@ -1,7 +1,6 @@ #pragma once #include <mbgl/gl/gl.hpp> -#include <mbgl/gl/object_store.hpp> #include <mbgl/gl/context.hpp> #include <mbgl/platform/log.hpp> #include <mbgl/util/noncopyable.hpp> @@ -40,10 +39,10 @@ public: } // Transfers this buffer to the GPU and binds the buffer to the GL context. - void bind(gl::ObjectStore& store, gl::Context& context) { + void bind(gl::Context& context) { const bool initialized { buffer }; if (!initialized) { - buffer = store.createBuffer(); + buffer = context.createBuffer(); } if (target == GL_ARRAY_BUFFER) { @@ -76,9 +75,9 @@ public: } // Uploads the buffer to the GPU to be available when we need it. - void upload(gl::ObjectStore& store, gl::Context& context) { + void upload(gl::Context& context) { if (!buffer) { - bind(store, context); + bind(context); } } diff --git a/src/mbgl/geometry/line_atlas.cpp b/src/mbgl/geometry/line_atlas.cpp index 2f4616f6e6..2131c43966 100644 --- a/src/mbgl/geometry/line_atlas.cpp +++ b/src/mbgl/geometry/line_atlas.cpp @@ -1,6 +1,5 @@ #include <mbgl/geometry/line_atlas.hpp> #include <mbgl/gl/gl.hpp> -#include <mbgl/gl/object_store.hpp> #include <mbgl/gl/context.hpp> #include <mbgl/platform/log.hpp> #include <mbgl/platform/platform.hpp> @@ -121,16 +120,16 @@ LinePatternPos LineAtlas::addDash(const std::vector<float>& dasharray, LinePatte return position; } -void LineAtlas::upload(gl::ObjectStore& store, gl::Context& context, uint32_t unit) { +void LineAtlas::upload(gl::Context& context, uint32_t unit) { if (dirty) { - bind(store, context, unit); + bind(context, unit); } } -void LineAtlas::bind(gl::ObjectStore& store, gl::Context& context, uint32_t unit) { +void LineAtlas::bind(gl::Context& context, uint32_t unit) { bool first = false; if (!texture) { - texture = store.createTexture(); + texture = context.createTexture(); context.activeTexture = unit; context.texture[unit] = *texture; MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); diff --git a/src/mbgl/geometry/line_atlas.hpp b/src/mbgl/geometry/line_atlas.hpp index 701c12c1ce..cb957901f3 100644 --- a/src/mbgl/geometry/line_atlas.hpp +++ b/src/mbgl/geometry/line_atlas.hpp @@ -1,11 +1,12 @@ #pragma once #include <mbgl/gl/gl.hpp> -#include <mbgl/gl/object_store.hpp> +#include <mbgl/gl/object.hpp> #include <mbgl/util/optional.hpp> #include <vector> #include <unordered_map> +#include <memory> namespace mbgl { @@ -30,11 +31,11 @@ public: ~LineAtlas(); // Binds the atlas texture to the GPU, and uploads data if it is out of date. - void bind(gl::ObjectStore&, gl::Context&, uint32_t unit); + void bind(gl::Context&, uint32_t unit); // Uploads the texture to the GPU to be available when we need it. This is a lazy operation; // the texture is only bound when the data is out of date (=dirty). - void upload(gl::ObjectStore&, gl::Context&, uint32_t unit); + void upload(gl::Context&, uint32_t unit); LinePatternPos getDashPosition(const std::vector<float>&, LinePatternCap); LinePatternPos addDash(const std::vector<float>& dasharray, LinePatternCap); diff --git a/src/mbgl/geometry/vao.cpp b/src/mbgl/geometry/vao.cpp index 283c45289e..6a95127970 100644 --- a/src/mbgl/geometry/vao.cpp +++ b/src/mbgl/geometry/vao.cpp @@ -1,6 +1,5 @@ #include <mbgl/geometry/vao.hpp> #include <mbgl/platform/log.hpp> -#include <mbgl/gl/object_store.hpp> #include <mbgl/util/string.hpp> namespace mbgl { @@ -10,7 +9,7 @@ VertexArrayObject::VertexArrayObject() { VertexArrayObject::~VertexArrayObject() = default; -void VertexArrayObject::bindVertexArrayObject(gl::ObjectStore& store, gl::Context& context) { +void VertexArrayObject::bindVertexArrayObject(gl::Context& context) { if (!gl::GenVertexArrays || !gl::BindVertexArray) { static bool reported = false; if (!reported) { @@ -21,7 +20,7 @@ void VertexArrayObject::bindVertexArrayObject(gl::ObjectStore& store, gl::Contex } if (!vao) { - vao = store.createVAO(); + vao = context.createVAO(); context.vertexBuffer.setDirty(); context.elementBuffer.setDirty(); } diff --git a/src/mbgl/geometry/vao.hpp b/src/mbgl/geometry/vao.hpp index 98ce3527cc..2cb81481f2 100644 --- a/src/mbgl/geometry/vao.hpp +++ b/src/mbgl/geometry/vao.hpp @@ -2,7 +2,6 @@ #include <mbgl/shader/shader.hpp> #include <mbgl/gl/gl.hpp> -#include <mbgl/gl/object_store.hpp> #include <mbgl/gl/context.hpp> #include <mbgl/util/noncopyable.hpp> #include <mbgl/util/optional.hpp> @@ -20,11 +19,10 @@ public: void bind(Shader& shader, VertexBuffer& vertexBuffer, GLbyte* offset, - gl::ObjectStore& store, gl::Context& context) { - bindVertexArrayObject(store, context); + bindVertexArrayObject(context); if (bound_shader == 0) { - vertexBuffer.bind(store, context); + vertexBuffer.bind(context); shader.bind(offset); if (vao) { storeBinding(shader, vertexBuffer.getID(), 0, offset); @@ -39,12 +37,11 @@ public: VertexBuffer& vertexBuffer, ElementsBuffer& elementsBuffer, GLbyte* offset, - gl::ObjectStore& store, gl::Context& context) { - bindVertexArrayObject(store, context); + bindVertexArrayObject(context); if (bound_shader == 0) { - vertexBuffer.bind(store, context); - elementsBuffer.bind(store, context); + vertexBuffer.bind(context); + elementsBuffer.bind(context); shader.bind(offset); if (vao) { storeBinding(shader, vertexBuffer.getID(), elementsBuffer.getID(), offset); @@ -59,7 +56,7 @@ public: } private: - void bindVertexArrayObject(gl::ObjectStore&, gl::Context&); + void bindVertexArrayObject(gl::Context&); void storeBinding(Shader &shader, GLuint vertexBuffer, GLuint elementsBuffer, GLbyte *offset); void verifyBinding(Shader &shader, GLuint vertexBuffer, GLuint elementsBuffer, GLbyte *offset); |