Skip to content

Commit

Permalink
Add semicolon after Tracy preprocessor macros (#2753)
Browse files Browse the repository at this point in the history
Co-authored-by: Bart Louwers <[email protected]>
  • Loading branch information
alexcristici and louwers authored Aug 27, 2024
1 parent dd104de commit 6a7bf2f
Show file tree
Hide file tree
Showing 38 changed files with 335 additions and 328 deletions.
70 changes: 35 additions & 35 deletions include/mbgl/util/instrumentation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,24 @@ const void* castGpuIdToTracyPtr(GpuId id) {
#define MLN_ZONE_VALUE(n) ZoneValue(n)

constexpr const char* tracyTextureMemoryLabel = "Texture Memory";
#define MLN_TRACE_ALLOC_TEXTURE(id, size) TracyAllocN(castGpuIdToTracyPtr(id), size, tracyTextureMemoryLabel);
#define MLN_TRACE_FREE_TEXTURE(id) TracyFreeN(castGpuIdToTracyPtr(id), tracyTextureMemoryLabel);
#define MLN_TRACE_ALLOC_TEXTURE(id, size) TracyAllocN(castGpuIdToTracyPtr(id), size, tracyTextureMemoryLabel)
#define MLN_TRACE_FREE_TEXTURE(id) TracyFreeN(castGpuIdToTracyPtr(id), tracyTextureMemoryLabel)

constexpr const char* tracyRenderTargetMemoryLabel = "Render Target Memory";
#define MLN_TRACE_ALLOC_RT(id, size) TracyAllocN(castGpuIdToTracyPtr(id), size, tracyRenderTargetMemoryLabel);
#define MLN_TRACE_FREE_RT(id) TracyFreeN(castGpuIdToTracyPtr(id), tracyRenderTargetMemoryLabel);
#define MLN_TRACE_ALLOC_RT(id, size) TracyAllocN(castGpuIdToTracyPtr(id), size, tracyRenderTargetMemoryLabel)
#define MLN_TRACE_FREE_RT(id) TracyFreeN(castGpuIdToTracyPtr(id), tracyRenderTargetMemoryLabel)

constexpr const char* tracyVertexMemoryLabel = "Vertex Buffer Memory";
#define MLN_TRACE_ALLOC_VERTEX_BUFFER(id, size) TracyAllocN(castGpuIdToTracyPtr(id), size, tracyVertexMemoryLabel);
#define MLN_TRACE_FREE_VERTEX_BUFFER(id) TracyFreeN(castGpuIdToTracyPtr(id), tracyVertexMemoryLabel);
#define MLN_TRACE_ALLOC_VERTEX_BUFFER(id, size) TracyAllocN(castGpuIdToTracyPtr(id), size, tracyVertexMemoryLabel)
#define MLN_TRACE_FREE_VERTEX_BUFFER(id) TracyFreeN(castGpuIdToTracyPtr(id), tracyVertexMemoryLabel)

constexpr const char* tracyIndexMemoryLabel = "Index Buffer Memory";
#define MLN_TRACE_ALLOC_INDEX_BUFFER(id, size) TracyAllocN(castGpuIdToTracyPtr(id), size, tracyIndexMemoryLabel);
#define MLN_TRACE_FREE_INDEX_BUFFER(id) TracyFreeN(castGpuIdToTracyPtr(id), tracyIndexMemoryLabel);
#define MLN_TRACE_ALLOC_INDEX_BUFFER(id, size) TracyAllocN(castGpuIdToTracyPtr(id), size, tracyIndexMemoryLabel)
#define MLN_TRACE_FREE_INDEX_BUFFER(id) TracyFreeN(castGpuIdToTracyPtr(id), tracyIndexMemoryLabel)

constexpr const char* tracyConstMemoryLabel = "Constant Buffer Memory";
#define MLN_TRACE_ALLOC_CONST_BUFFER(id, size) TracyAllocN(castGpuIdToTracyPtr(id), size, tracyConstMemoryLabel);
#define MLN_TRACE_FREE_CONST_BUFFER(id) TracyFreeN(castGpuIdToTracyPtr(id), tracyConstMemoryLabel);
#define MLN_TRACE_ALLOC_CONST_BUFFER(id, size) TracyAllocN(castGpuIdToTracyPtr(id), size, tracyConstMemoryLabel)
#define MLN_TRACE_FREE_CONST_BUFFER(id) TracyFreeN(castGpuIdToTracyPtr(id), tracyConstMemoryLabel)

// Only OpenGL is currently considered for GPU profiling
// Metal and other APIs need to be handled separately
Expand All @@ -70,9 +70,9 @@ constexpr const char* tracyConstMemoryLabel = "Constant Buffer Memory";

#include "tracy/TracyOpenGL.hpp"

#define MLN_TRACE_GL_CONTEXT() TracyGpuContext;
#define MLN_TRACE_GL_ZONE(label) TracyGpuZone(#label);
#define MLN_TRACE_FUNC_GL() TracyGpuZone(__FUNCTION__);
#define MLN_TRACE_GL_CONTEXT() TracyGpuContext
#define MLN_TRACE_GL_ZONE(label) TracyGpuZone(#label)
#define MLN_TRACE_FUNC_GL() TracyGpuZone(__FUNCTION__)

#define MLN_END_FRAME() \
do { \
Expand All @@ -90,33 +90,33 @@ constexpr const char* tracyConstMemoryLabel = "Constant Buffer Memory";

#else // MLN_RENDER_BACKEND_OPENGL

#define MLN_TRACE_GL_CONTEXT()
#define MLN_TRACE_GL_ZONE(label)
#define MLN_TRACE_FUNC_GL()
#define MLN_TRACE_GL_CONTEXT() ((void)0)
#define MLN_TRACE_GL_ZONE(label) ((void)0)
#define MLN_TRACE_FUNC_GL() ((void)0)
#define MLN_END_FRAME() FrameMark;

#endif // MLN_RENDER_BACKEND_OPENGL

#else // MLN_TRACY_ENABLE

#define MLN_TRACE_GL_CONTEXT()
#define MLN_TRACE_GL_ZONE(label)
#define MLN_ZONE_TEXT(label)
#define MLN_ZONE_STR(str)
#define MLN_ZONE_VALUE(val)
#define MLN_TRACE_FUNC_GL()
#define MLN_END_FRAME()
#define MLN_TRACE_ALLOC_TEXTURE(id, size)
#define MLN_TRACE_FREE_TEXTURE(id)
#define MLN_TRACE_ALLOC_RT(id, size)
#define MLN_TRACE_FREE_RT(id)
#define MLN_TRACE_ALLOC_VERTEX_BUFFER(id, size)
#define MLN_TRACE_FREE_VERTEX_BUFFER(id)
#define MLN_TRACE_ALLOC_INDEX_BUFFER(id, size)
#define MLN_TRACE_FREE_INDEX_BUFFER(id)
#define MLN_TRACE_ALLOC_CONST_BUFFER(id, size)
#define MLN_TRACE_FREE_CONST_BUFFER(id)
#define MLN_TRACE_FUNC()
#define MLN_TRACE_ZONE(label)
#define MLN_TRACE_GL_CONTEXT() ((void)0)
#define MLN_TRACE_GL_ZONE(label) ((void)0)
#define MLN_ZONE_TEXT(label) ((void)0)
#define MLN_ZONE_STR(str) ((void)0)
#define MLN_ZONE_VALUE(val) ((void)0)
#define MLN_TRACE_FUNC_GL() ((void)0)
#define MLN_END_FRAME() ((void)0)
#define MLN_TRACE_ALLOC_TEXTURE(id, size) ((void)0)
#define MLN_TRACE_FREE_TEXTURE(id) ((void)0)
#define MLN_TRACE_ALLOC_RT(id, size) ((void)0)
#define MLN_TRACE_FREE_RT(id) ((void)0)
#define MLN_TRACE_ALLOC_VERTEX_BUFFER(id, size) ((void)0)
#define MLN_TRACE_FREE_VERTEX_BUFFER(id) ((void)0)
#define MLN_TRACE_ALLOC_INDEX_BUFFER(id, size) ((void)0)
#define MLN_TRACE_FREE_INDEX_BUFFER(id) ((void)0)
#define MLN_TRACE_ALLOC_CONST_BUFFER(id, size) ((void)0)
#define MLN_TRACE_FREE_CONST_BUFFER(id) ((void)0)
#define MLN_TRACE_FUNC() ((void)0)
#define MLN_TRACE_ZONE(label) ((void)0)

#endif // MLN_TRACY_ENABLE
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void AndroidRendererFrontend::setObserver(RendererObserver& observer) {
}

void AndroidRendererFrontend::update(std::shared_ptr<UpdateParameters> params) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
updateParams = std::move(params);
updateAsyncTask->send();
}
Expand Down
4 changes: 2 additions & 2 deletions platform/android/MapLibreAndroid/src/cpp/map_renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ ActorRef<Renderer> MapRenderer::actor() const {
}

void MapRenderer::schedule(std::function<void()>&& scheduled) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
try {
// Create a runnable
android::UniqueEnv _env = android::AttachEnv();
Expand All @@ -78,7 +78,7 @@ void MapRenderer::schedule(std::function<void()>&& scheduled) {
static auto queueEvent = javaClass.GetMethod<void(jni::Object<MapRendererRunnable>)>(*_env, "queueEvent");
auto weakReference = javaPeer.get(*_env);
if (weakReference) {
MLN_TRACE_ZONE(java)
MLN_TRACE_ZONE(java);
weakReference.Call(*_env, queueEvent, peer);
}

Expand Down
16 changes: 8 additions & 8 deletions platform/default/src/mbgl/gl/headless_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class HeadlessRenderableResource final : public gl::RenderableResource {
}

void swap() override {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();

backend.swap();
}
Expand All @@ -49,7 +49,7 @@ HeadlessBackend::HeadlessBackend(const Size size_,
swapBehaviour(swapBehaviour_) {}

HeadlessBackend::~HeadlessBackend() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();

gfx::BackendScope guard{*this, gfx::BackendScope::ScopeType::Implicit};
// Some implementations require active context for GL functions to work
Expand All @@ -73,7 +73,7 @@ gl::ProcAddress HeadlessBackend::getExtensionFunctionPointer(const char* name) {
}

void HeadlessBackend::activate() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();

active = true;

Expand All @@ -86,15 +86,15 @@ void HeadlessBackend::activate() {
}

void HeadlessBackend::deactivate() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();

assert(impl);
impl->deactivateContext();
active = false;
}

gfx::Renderable& HeadlessBackend::getDefaultRenderable() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();

if (!resource) {
resource = std::make_unique<HeadlessRenderableResource>(*this, static_cast<gl::Context&>(getContext()), size);
Expand All @@ -103,7 +103,7 @@ gfx::Renderable& HeadlessBackend::getDefaultRenderable() {
}

void HeadlessBackend::swap() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();

if (swapBehaviour == SwapBehaviour::Flush) static_cast<gl::Context&>(getContext()).finish();
}
Expand All @@ -113,7 +113,7 @@ void HeadlessBackend::updateAssumedState() {
}

PremultipliedImage HeadlessBackend::readStillImage() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();

return static_cast<gl::Context&>(getContext()).readFramebuffer<PremultipliedImage>(size);
}
Expand All @@ -129,7 +129,7 @@ namespace gfx {
template <>
std::unique_ptr<gfx::HeadlessBackend> Backend::Create<gfx::Backend::Type::OpenGL>(
const Size size, gfx::Renderable::SwapBehaviour swapBehavior, const gfx::ContextMode contextMode) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();

return std::make_unique<gl::HeadlessBackend>(size, swapBehavior, contextMode);
}
Expand Down
16 changes: 8 additions & 8 deletions platform/glfw/glfw_gl_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ class GLFWGLRenderableResource final : public mbgl::gl::RenderableResource {
: backend(backend_) {}

void bind() override {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();

backend.setFramebufferBinding(0);
backend.setViewport(0, 0, backend.getSize());
}

void swap() override {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();

backend.swap();
}
Expand All @@ -39,7 +39,7 @@ GLFWGLBackend::GLFWGLBackend(GLFWwindow* window_, const bool capFrameRate)
}(),
std::make_unique<GLFWGLRenderableResource>(*this)),
window(window_) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();

glfwMakeContextCurrent(window);
if (!capFrameRate) {
Expand All @@ -53,13 +53,13 @@ GLFWGLBackend::GLFWGLBackend(GLFWwindow* window_, const bool capFrameRate)
GLFWGLBackend::~GLFWGLBackend() = default;

void GLFWGLBackend::activate() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();

glfwMakeContextCurrent(window);
}

void GLFWGLBackend::deactivate() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();

glfwMakeContextCurrent(nullptr);
}
Expand All @@ -69,7 +69,7 @@ mbgl::gl::ProcAddress GLFWGLBackend::getExtensionFunctionPointer(const char* nam
}

void GLFWGLBackend::updateAssumedState() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();

assumeFramebufferBinding(0);
setViewport(0, 0, size);
Expand All @@ -84,7 +84,7 @@ void GLFWGLBackend::setSize(const mbgl::Size newSize) {
}

void GLFWGLBackend::swap() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();

glfwSwapBuffers(window);
}
Expand All @@ -94,7 +94,7 @@ namespace gfx {

template <>
std::unique_ptr<GLFWBackend> Backend::Create<mbgl::gfx::Backend::Type::OpenGL>(GLFWwindow* window, bool capFrameRate) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();

return std::make_unique<GLFWGLBackend>(window, capFrameRate);
}
Expand Down
2 changes: 1 addition & 1 deletion platform/glfw/glfw_renderer_frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const mbgl::TaggedScheduler& GLFWRendererFrontend::getThreadPool() const {
}

void GLFWRendererFrontend::render() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();

assert(renderer);

Expand Down
Loading

0 comments on commit 6a7bf2f

Please sign in to comment.