Files
MapLibreParticleLab/include/mbgl/gfx/backend_scope.hpp
Bart Louwers 71f6da2722 Add clang-format (#1086)
Co-authored-by: mwilsnd <mwilsnd@gmail.com>
2023-05-01 16:57:37 +02:00

39 lines
970 B
C++

#pragma once
namespace mbgl {
namespace gfx {
class RendererBackend;
class BackendScope {
public:
/// There are two types of scopes: Creating an "Implicit" scope tells Mapbox
/// GL that the supporting windowing system has already activated the GL
/// Backend and that no further actions are required. Creating an "Explicit"
/// scope actually enables the GL Backend, and disables it when the
/// BackendScope is destroyed.
enum class ScopeType : bool {
Implicit,
Explicit,
};
BackendScope(RendererBackend&, ScopeType = ScopeType::Explicit);
~BackendScope();
// Returns true when there is currently a BackendScope active in this thread.
static bool exists();
private:
void activate();
void deactivate();
BackendScope* priorScope;
BackendScope* nextScope;
RendererBackend& backend;
const ScopeType scopeType;
bool activated = false;
};
} // namespace gfx
} // namespace mbgl