summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2017-07-25 10:44:19 +0300
committerIvo van Dongen <ivovandongen@users.noreply.github.com>2017-07-25 17:44:28 +0300
commit27343c6a75aba9c4d04b0362fc0e50889f0e2e69 (patch)
tree028cd06f534b09f1df7871cd11e0b726e0ce0377
parent906fc0421aa85308460586023cfe727501c9bbb5 (diff)
downloadqtlocation-mapboxgl-27343c6a75aba9c4d04b0362fc0e50889f0e2e69.tar.gz
[core] fix backend scope handling on render, cleanup and lowmemory
- Make renderer frontend responsible for creating a BackendScope on render - encapsulate backend scope handling on cleanup and low memory in renderer impl
-rw-r--r--include/mbgl/renderer/renderer_backend.hpp4
-rw-r--r--src/mbgl/renderer/renderer_impl.cpp8
2 files changed, 4 insertions, 8 deletions
diff --git a/include/mbgl/renderer/renderer_backend.hpp b/include/mbgl/renderer/renderer_backend.hpp
index a383329395..c12e162fd1 100644
--- a/include/mbgl/renderer/renderer_backend.hpp
+++ b/include/mbgl/renderer/renderer_backend.hpp
@@ -30,10 +30,6 @@ public:
// Called prior to rendering to update the internally assumed OpenGL state.
virtual void updateAssumedState() = 0;
- virtual BackendScope::ScopeType getScopeType() const {
- return BackendScope::ScopeType::Explicit;
- }
-
protected:
// Called with the name of an OpenGL extension that should be loaded. RendererBackend implementations
// must call the API-specific version that obtains the function pointer for this function,
diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp
index 981c09e806..4c45ab167d 100644
--- a/src/mbgl/renderer/renderer_impl.cpp
+++ b/src/mbgl/renderer/renderer_impl.cpp
@@ -35,7 +35,7 @@ Renderer::Impl::Impl(RendererBackend& backend_,
}
Renderer::Impl::~Impl() {
- BackendScope guard { backend, backend.getScopeType()};
+ BackendScope guard { backend };
renderStyle.reset();
staticData.reset();
};
@@ -47,8 +47,8 @@ void Renderer::Impl::setObserver(RendererObserver* observer_) {
void Renderer::Impl::render(View& view, const UpdateParameters& updateParameters) {
// Don't load/render anyting in still mode until explicitly requested.
if (updateParameters.mode == MapMode::Still && !updateParameters.stillImageRequest) return;
-
- BackendScope guard { backend, backend.getScopeType() };
+
+ assert(BackendScope::exists());
renderStyle->update(updateParameters);
transformState = updateParameters.transformState;
@@ -348,7 +348,7 @@ void Renderer::Impl::onResourceError(std::exception_ptr ptr) {
}
void Renderer::Impl::onLowMemory() {
- BackendScope guard { backend, backend.getScopeType() };
+ BackendScope guard { backend };
backend.getContext().performCleanup();
renderStyle->onLowMemory();
observer->onInvalidate();