Add Tracy instrumentation for CPU and GPU in OpenGL mode. (#2417)

This commit is contained in:
alasram
2024-06-17 10:20:14 -07:00
committed by GitHub
parent 30484d8f50
commit 4f0f3bac51
45 changed files with 1091 additions and 19 deletions

View File

@@ -1,5 +1,6 @@
#include <mbgl/gfx/backend_scope.hpp>
#include <mbgl/gfx/renderer_backend.hpp>
#include <mbgl/util/instrumentation.hpp>
#include <mbgl/util/thread_local.hpp>
#include <cassert>
@@ -22,6 +23,8 @@ BackendScope::BackendScope(RendererBackend& backend_, ScopeType scopeType_)
nextScope(nullptr),
backend(backend_),
scopeType(scopeType_) {
MLN_TRACE_FUNC();
if (priorScope) {
assert(priorScope->nextScope == nullptr);
priorScope->nextScope = this;
@@ -34,6 +37,8 @@ BackendScope::BackendScope(RendererBackend& backend_, ScopeType scopeType_)
}
BackendScope::~BackendScope() {
MLN_TRACE_FUNC();
assert(nextScope == nullptr);
deactivate();
@@ -48,6 +53,8 @@ BackendScope::~BackendScope() {
}
void BackendScope::activate() {
MLN_TRACE_FUNC();
if (scopeType == ScopeType::Explicit && !(priorScope && this->backend == priorScope->backend) &&
!(nextScope && this->backend == nextScope->backend)) {
// Only activate when set to Explicit and