summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLeith Bade <leith@leithalweapon.geek.nz>2014-06-24 00:41:28 +1000
committerMike Morris <michael.patrick.morris@gmail.com>2014-09-10 18:31:20 -0400
commit71549e7b93b6b44ed38e8915d8735c136889c3f1 (patch)
tree41713e8771be946304e9f04cf4477b34e17cd6e8 /include
parentc004c036964e9012b08aa4a2f8b16094630d62be (diff)
downloadqtlocation-mapboxgl-71549e7b93b6b44ed38e8915d8735c136889c3f1.tar.gz
Adds the function Map::terminate() to allow all GL resources held
by the map to be released immediately. Map::terminate() will call any GL functions on the current thread without blocking or defering to the rendering thread. This function allows a GL context to be destroyed and recreated safely without having to delete the Map object. Fixes mapbox/mapbox-gl-native#341 Conflicts: include/llmr/renderer/painter.hpp test/headless.cpp
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/map/map.hpp3
-rw-r--r--include/mbgl/renderer/painter.hpp2
2 files changed, 5 insertions, 0 deletions
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp
index fba38879ed..0d2926d04b 100644
--- a/include/mbgl/map/map.hpp
+++ b/include/mbgl/map/map.hpp
@@ -53,6 +53,9 @@ public:
// Triggers a cleanup that releases resources.
void cleanup();
+ // Releases resources immediately
+ void terminate();
+
// Controls buffer swapping.
bool needsSwap();
void swapped();
diff --git a/include/mbgl/renderer/painter.hpp b/include/mbgl/renderer/painter.hpp
index 75529d1136..15331b9b67 100644
--- a/include/mbgl/renderer/painter.hpp
+++ b/include/mbgl/renderer/painter.hpp
@@ -63,6 +63,7 @@ public:
// lazy initialization) in case rendering continues.
void cleanup();
+ void terminate();
// Renders the backdrop of the OpenGL view. This also paints in areas where we don't have any
// tiles whatsoever.
@@ -123,6 +124,7 @@ public:
private:
void setupShaders();
+ void deleteShaders();
mat4 translatedMatrix(const mat4& matrix, const std::array<float, 2> &translation, const Tile::ID &id, TranslateAnchorType anchor);
void prepareTile(const Tile& tile);