diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-03-18 15:37:06 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-03-20 19:47:54 +0100 |
commit | 61fa43619334ac68c66d45d38aaf681f2a21fa96 (patch) | |
tree | 9c2664c615417888618b40979bcf0050e31a8675 /src/mbgl/geometry/line_atlas.cpp | |
parent | 8fb1bbca8e57a99a556f6a4f0c295d5a8261ed02 (diff) | |
download | qtlocation-mapboxgl-61fa43619334ac68c66d45d38aaf681f2a21fa96.tar.gz |
coalesce buffer deletions and run them in bulk during rendering
On iOS, the main thread does framebuffer operations just before it requests a rerender of the view contents. This means that GL operations on the Map thread will interfere with that and cause a crash. While most GL operations happen throughout rendering (which is synchronized with the main thread), deletion of shared_ptrs release in turn their OpenGL objects. This may happen at any time and isn't synced with rendering.
This patch changes this so instead of deleting all objects immediately, we are collecting all abandoned IDs and delete them in bulk once the main thread has given us permission to use OpenGL calls (i.e. during render()).
Diffstat (limited to 'src/mbgl/geometry/line_atlas.cpp')
-rw-r--r-- | src/mbgl/geometry/line_atlas.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mbgl/geometry/line_atlas.cpp b/src/mbgl/geometry/line_atlas.cpp index 8be1a8d53c..507cc7b087 100644 --- a/src/mbgl/geometry/line_atlas.cpp +++ b/src/mbgl/geometry/line_atlas.cpp @@ -1,3 +1,4 @@ +#include <mbgl/map/environment.hpp> #include <mbgl/geometry/line_atlas.hpp> #include <mbgl/platform/gl.hpp> #include <mbgl/platform/log.hpp> @@ -18,9 +19,10 @@ LineAtlas::LineAtlas(uint16_t w, uint16_t h) LineAtlas::~LineAtlas() { std::lock_guard<std::recursive_mutex> lock(mtx); - MBGL_CHECK_ERROR(glDeleteTextures(1, &texture)); - delete[] data; + Environment::Get().abandonTexture(texture); texture = 0; + + delete[] data; } LinePatternPos LineAtlas::getDashPosition(const std::vector<float> &dasharray, bool round) { |