summaryrefslogtreecommitdiff
path: root/include/mbgl/gfx
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-04-02 16:34:32 +0200
committerKonstantin Käfer <mail@kkaefer.com>2019-04-05 11:49:17 +0200
commit5cc3d7a73328d6df9c16d27d6aca5b49ba085351 (patch)
tree0e8b9d6938846bf12ea63b1568c96852501a68cc /include/mbgl/gfx
parent4053776c27cde354acc36c27120c54427087721b (diff)
downloadqtlocation-mapboxgl-5cc3d7a73328d6df9c16d27d6aca5b49ba085351.tar.gz
[core] move GLContextMode to RendererBackend
Diffstat (limited to 'include/mbgl/gfx')
-rw-r--r--include/mbgl/gfx/renderer_backend.hpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/mbgl/gfx/renderer_backend.hpp b/include/mbgl/gfx/renderer_backend.hpp
index 032c7021da..29f6b43a8f 100644
--- a/include/mbgl/gfx/renderer_backend.hpp
+++ b/include/mbgl/gfx/renderer_backend.hpp
@@ -12,10 +12,15 @@ class Context;
class Renderable;
class BackendScope;
-// TODO: Rename to "Device"
+// We can make some optimizations if we know that the drawing context is not shared with other code.
+enum class ContextMode : bool {
+ Unique,
+ Shared,
+};
+
class RendererBackend {
protected:
- explicit RendererBackend();
+ explicit RendererBackend(ContextMode);
public:
virtual ~RendererBackend();
@@ -25,6 +30,10 @@ public:
// Returns the device's context.
Context& getContext();
+ bool contextIsShared() const {
+ return contextMode == ContextMode::Shared;
+ }
+
// Returns a reference to the default surface that should be rendered on.
virtual Renderable& getDefaultRenderable() = 0;
@@ -44,6 +53,7 @@ protected:
protected:
std::unique_ptr<Context> context;
+ const ContextMode contextMode;
std::once_flag initialized;
friend class BackendScope;