diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/renderer/backend_scope.hpp (renamed from include/mbgl/map/backend_scope.hpp) | 6 | ||||
-rw-r--r-- | include/mbgl/renderer/renderer.hpp | 4 | ||||
-rw-r--r-- | include/mbgl/renderer/renderer_backend.hpp (renamed from include/mbgl/map/backend.hpp) | 30 |
3 files changed, 20 insertions, 20 deletions
diff --git a/include/mbgl/map/backend_scope.hpp b/include/mbgl/renderer/backend_scope.hpp index 4985cd197f..f8a258f3df 100644 --- a/include/mbgl/map/backend_scope.hpp +++ b/include/mbgl/renderer/backend_scope.hpp @@ -2,7 +2,7 @@ namespace mbgl { -class Backend; +class RendererBackend; class BackendScope { public: @@ -15,7 +15,7 @@ public: Explicit, }; - BackendScope(Backend&, ScopeType = ScopeType::Explicit); + BackendScope(RendererBackend&, ScopeType = ScopeType::Explicit); ~BackendScope(); // Returns true when there is currently a BackendScope active in this thread. @@ -24,7 +24,7 @@ public: private: BackendScope* priorScope; BackendScope* nextScope; - Backend& backend; + RendererBackend& backend; const ScopeType scopeType; }; diff --git a/include/mbgl/renderer/renderer.hpp b/include/mbgl/renderer/renderer.hpp index 6626f74d3d..c209e03045 100644 --- a/include/mbgl/renderer/renderer.hpp +++ b/include/mbgl/renderer/renderer.hpp @@ -13,8 +13,8 @@ namespace mbgl { -class Backend; class FileSource; +class RendererBackend; class RendererObserver; class RenderedQueryOptions; class Scheduler; @@ -24,7 +24,7 @@ class View; class Renderer { public: - Renderer(Backend&, float pixelRatio_, FileSource&, Scheduler&, + Renderer(RendererBackend&, float pixelRatio_, FileSource&, Scheduler&, GLContextMode = GLContextMode::Unique, const optional<std::string> programCacheDir = optional<std::string>()); ~Renderer(); diff --git a/include/mbgl/map/backend.hpp b/include/mbgl/renderer/renderer_backend.hpp index 3347086571..9d967fd51b 100644 --- a/include/mbgl/map/backend.hpp +++ b/include/mbgl/renderer/renderer_backend.hpp @@ -1,7 +1,7 @@ #pragma once #include <mbgl/map/view.hpp> -#include <mbgl/map/backend_scope.hpp> +#include <mbgl/renderer/backend_scope.hpp> #include <mbgl/util/image.hpp> #include <mbgl/util/size.hpp> @@ -16,10 +16,12 @@ using ProcAddress = void (*)(); using FramebufferID = uint32_t; } // namespace gl -class Backend { +// The RendererBackend is used by the Renderer to facilitate +// the actual rendering. +class RendererBackend { public: - Backend(); - virtual ~Backend(); + RendererBackend(); + virtual ~RendererBackend(); // Returns the backend's context which manages OpenGL state. gl::Context& getContext(); @@ -27,26 +29,24 @@ public: // Called prior to rendering to update the internally assumed OpenGL state. virtual void updateAssumedState() = 0; - inline virtual BackendScope::ScopeType getScopeType() const { + virtual BackendScope::ScopeType getScopeType() const { return BackendScope::ScopeType::Explicit; - }; + } protected: - // Called with the name of an OpenGL extension that should be loaded. Backend implementations + // 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, // or a null pointer if unsupported/unavailable. virtual gl::ProcAddress initializeExtension(const char*) = 0; // Called when the backend's GL context needs to be made active or inactive. These are called, - // as a matched pair, in four situations: + // as a matched pair, exclusively through BackendScope, in two situations: // - // 1. When releasing GL resources during Map destruction - // 2. When calling a CustomLayerInitializeFunction, during Map::addLayer - // 3. When calling a CustomLayerDeinitializeFunction, during Map::removeLayer - // 4. When rendering for Map::renderStill - // - // They are *not* called for Map::render; it is assumed that the correct context is already - // activated prior to calling Map::render. + // 1. When releasing GL resources during Renderer destruction + // (Including calling CustomLayerDeinitializeFunction during RenderCustomLayer destruction) + // 2. When renderering through Renderer::render() + // (Including calling CustomLayerDeinitializeFunction for newly added custom layers and + // CustomLayerDeinitializeFunction on layer removal) virtual void activate() = 0; virtual void deactivate() = 0; |