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,10 +1,18 @@
#include <mbgl/gl/context.hpp>
#include <mbgl/gl/vertex_buffer_resource.hpp>
#include <mbgl/util/instrumentation.hpp>
namespace mbgl {
namespace gl {
VertexBufferResource::VertexBufferResource(UniqueBuffer&& buffer_, int byteSize_)
: buffer(std::move(buffer_)),
byteSize(byteSize_) {
MLN_TRACE_ALLOC_VERTEX_BUFFER(buffer.get(), byteSize);
}
VertexBufferResource::~VertexBufferResource() noexcept {
MLN_TRACE_FREE_VERTEX_BUFFER(buffer.get());
auto& stats = buffer.get_deleter().context.renderingStats();
stats.memVertexBuffers -= byteSize;
assert(stats.memVertexBuffers >= 0);