diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-06-27 13:44:46 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-27 13:44:46 -0700 |
commit | 8956179ce06bca099fca765ce6172980dfe7a998 (patch) | |
tree | 178bc722da840b3bbc19a35072aae3df6261701e /src/mbgl/util | |
parent | b8326870e1f3960b169746b0473326060bb6cf54 (diff) | |
download | qtlocation-mapboxgl-8956179ce06bca099fca765ce6172980dfe7a998.tar.gz |
[core] Merge TexturePool into ObjectStore; pool all textures (#5477)
Diffstat (limited to 'src/mbgl/util')
-rw-r--r-- | src/mbgl/util/raster.cpp | 8 | ||||
-rw-r--r-- | src/mbgl/util/raster.hpp | 9 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/mbgl/util/raster.cpp b/src/mbgl/util/raster.cpp index d83bee4c3f..fc9cc1c256 100644 --- a/src/mbgl/util/raster.cpp +++ b/src/mbgl/util/raster.cpp @@ -26,14 +26,14 @@ void Raster::load(PremultipliedImage image) { } -void Raster::bind(bool linear, gl::TexturePool& texturePool, gl::ObjectStore& store) { +void Raster::bind(bool linear, gl::ObjectStore& store) { if (!width || !height) { Log::Error(Event::OpenGL, "trying to bind texture without dimension"); return; } if (img.data && !texture) { - upload(texturePool, store); + upload(store); } else if (texture) { MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, *texture)); } @@ -46,9 +46,9 @@ void Raster::bind(bool linear, gl::TexturePool& texturePool, gl::ObjectStore& st } } -void Raster::upload(gl::TexturePool& texturePool, gl::ObjectStore& store) { +void Raster::upload(gl::ObjectStore& store) { if (img.data && !texture) { - texture = texturePool.acquireTexture(store); + texture = store.createTexture(); MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, *texture)); #ifndef GL_ES_VERSION_2_0 MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0)); diff --git a/src/mbgl/util/raster.hpp b/src/mbgl/util/raster.hpp index 31a9853d16..17319394c4 100644 --- a/src/mbgl/util/raster.hpp +++ b/src/mbgl/util/raster.hpp @@ -1,7 +1,6 @@ #pragma once -#include <mbgl/gl/gl.hpp> -#include <mbgl/gl/texture_pool.hpp> +#include <mbgl/gl/object_store.hpp> #include <mbgl/util/image.hpp> #include <mbgl/util/ptr.hpp> #include <mbgl/util/chrono.hpp> @@ -18,10 +17,10 @@ public: void load(PremultipliedImage); // bind current texture - void bind(bool linear, gl::TexturePool&, gl::ObjectStore&); + void bind(bool linear, gl::ObjectStore&); // uploads the texture if it hasn't been uploaded yet. - void upload(gl::TexturePool&, gl::ObjectStore&); + void upload(gl::ObjectStore&); // loaded status bool isLoaded() const; @@ -32,7 +31,7 @@ public: GLsizei height = 0; // GL buffer object handle. - mbgl::optional<gl::PooledTexture> texture; + mbgl::optional<gl::UniqueTexture> texture; // texture opacity double opacity = 0; |