summaryrefslogtreecommitdiff
path: root/include/mbgl/style/layers
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2017-09-19 10:29:51 +0300
committerIvo van Dongen <ivovandongen@users.noreply.github.com>2017-09-22 23:33:56 +0300
commit97a010cc9bde2eaa2cc94ca844fe9546347d37c2 (patch)
treecfb1750b338022a8cd825de12f54670b1b981258 /include/mbgl/style/layers
parentb0c06c764b0f9900dac3707dc5af398b41b6aa5b (diff)
downloadqtlocation-mapboxgl-97a010cc9bde2eaa2cc94ca844fe9546347d37c2.tar.gz
[core] custom layer - add contextLost callback
- optional callback method that can be used to do cleanup when the context has been lost before re-initialisation
Diffstat (limited to 'include/mbgl/style/layers')
-rw-r--r--include/mbgl/style/layers/custom_layer.hpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/mbgl/style/layers/custom_layer.hpp b/include/mbgl/style/layers/custom_layer.hpp
index 79a353b047..bf3387f95b 100644
--- a/include/mbgl/style/layers/custom_layer.hpp
+++ b/include/mbgl/style/layers/custom_layer.hpp
@@ -39,6 +39,14 @@ struct CustomLayerRenderParameters {
using CustomLayerRenderFunction = void (*)(void* context, const CustomLayerRenderParameters&);
/**
+ * Called when the system has destroyed the underlying GL context. The
+ * `CustomLayerDeinitializeFunction` will not be called in this case, however
+ * `CustomLayerInitializeFunction` will be called instead to prepare for a new render.
+ *
+ */
+using CustomLayerContextLostFunction = void (*)(void* context);
+
+/**
* Destroy any GL state needed by the custom layer, and deallocate context, if necessary. This
* method is called once, from the main thread, at a point when the GL context is active.
*
@@ -51,8 +59,16 @@ public:
CustomLayer(const std::string& id,
CustomLayerInitializeFunction,
CustomLayerRenderFunction,
+ CustomLayerContextLostFunction,
CustomLayerDeinitializeFunction,
void* context);
+
+ CustomLayer(const std::string& id,
+ CustomLayerInitializeFunction,
+ CustomLayerRenderFunction,
+ CustomLayerDeinitializeFunction,
+ void* context);
+
~CustomLayer() final;
// Visibility