summaryrefslogtreecommitdiff
path: root/src/mbgl/map/backend.cpp
blob: c228719ba642b54eb56f15d68b9b2358174782e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <mbgl/map/backend.hpp>
#include <mbgl/map/backend_scope.hpp>
#include <mbgl/gl/context.hpp>
#include <mbgl/gl/extension.hpp>
#include <mbgl/gl/debugging.hpp>

#include <cassert>

namespace mbgl {

Backend::Backend() = default;

gl::Context& Backend::getContext() {
    assert(BackendScope::exists());
    std::call_once(initialized, [this] {
        context = std::make_unique<gl::Context>();
        context->enableDebugging();
        context->initializeExtensions(
            std::bind(&Backend::initializeExtension, this, std::placeholders::_1));
    });
    return *context;
}

Backend::~Backend() = default;

} // namespace mbgl