summaryrefslogtreecommitdiff
path: root/src/mbgl/gfx/debug_group.hpp
blob: b7a25ad467dfd7b95ed6d28d8202d1251fc17e53 (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
27
28
#pragma once

namespace mbgl {
namespace gfx {

template <typename T>
class DebugGroup {
public:
    DebugGroup(T& scope_, const char* name) : scope(&scope_) {
        scope->pushDebugGroup(name);
    }

    DebugGroup(DebugGroup&& rhs) : scope(rhs.scope) {
        rhs.scope = nullptr;
    }

    ~DebugGroup() {
        if (scope) {
            scope->popDebugGroup();
        }
    }

private:
    T* scope;
};

} // namespace gfx
} // namespace mbgl