diff --git a/include/mbgl/util/instrumentation.hpp b/include/mbgl/util/instrumentation.hpp index 3528a540a..c538cbd8e 100644 --- a/include/mbgl/util/instrumentation.hpp +++ b/include/mbgl/util/instrumentation.hpp @@ -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 @@ -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 { \ @@ -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 diff --git a/platform/android/MapLibreAndroid/src/cpp/android_renderer_frontend.cpp b/platform/android/MapLibreAndroid/src/cpp/android_renderer_frontend.cpp index da2bbc3e8..87977dd73 100644 --- a/platform/android/MapLibreAndroid/src/cpp/android_renderer_frontend.cpp +++ b/platform/android/MapLibreAndroid/src/cpp/android_renderer_frontend.cpp @@ -79,7 +79,7 @@ void AndroidRendererFrontend::setObserver(RendererObserver& observer) { } void AndroidRendererFrontend::update(std::shared_ptr params) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); updateParams = std::move(params); updateAsyncTask->send(); } diff --git a/platform/android/MapLibreAndroid/src/cpp/map_renderer.cpp b/platform/android/MapLibreAndroid/src/cpp/map_renderer.cpp index e71a4700c..6fa7ae17e 100644 --- a/platform/android/MapLibreAndroid/src/cpp/map_renderer.cpp +++ b/platform/android/MapLibreAndroid/src/cpp/map_renderer.cpp @@ -64,7 +64,7 @@ ActorRef MapRenderer::actor() const { } void MapRenderer::schedule(std::function&& scheduled) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); try { // Create a runnable android::UniqueEnv _env = android::AttachEnv(); @@ -78,7 +78,7 @@ void MapRenderer::schedule(std::function&& scheduled) { static auto queueEvent = javaClass.GetMethod)>(*_env, "queueEvent"); auto weakReference = javaPeer.get(*_env); if (weakReference) { - MLN_TRACE_ZONE(java) + MLN_TRACE_ZONE(java); weakReference.Call(*_env, queueEvent, peer); } diff --git a/platform/default/src/mbgl/gl/headless_backend.cpp b/platform/default/src/mbgl/gl/headless_backend.cpp index 1513d8917..63674eee5 100644 --- a/platform/default/src/mbgl/gl/headless_backend.cpp +++ b/platform/default/src/mbgl/gl/headless_backend.cpp @@ -29,7 +29,7 @@ public: } void swap() override { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); backend.swap(); } @@ -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 @@ -73,7 +73,7 @@ gl::ProcAddress HeadlessBackend::getExtensionFunctionPointer(const char* name) { } void HeadlessBackend::activate() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); active = true; @@ -86,7 +86,7 @@ void HeadlessBackend::activate() { } void HeadlessBackend::deactivate() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); assert(impl); impl->deactivateContext(); @@ -94,7 +94,7 @@ void HeadlessBackend::deactivate() { } gfx::Renderable& HeadlessBackend::getDefaultRenderable() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (!resource) { resource = std::make_unique(*this, static_cast(getContext()), size); @@ -103,7 +103,7 @@ gfx::Renderable& HeadlessBackend::getDefaultRenderable() { } void HeadlessBackend::swap() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (swapBehaviour == SwapBehaviour::Flush) static_cast(getContext()).finish(); } @@ -113,7 +113,7 @@ void HeadlessBackend::updateAssumedState() { } PremultipliedImage HeadlessBackend::readStillImage() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return static_cast(getContext()).readFramebuffer(size); } @@ -129,7 +129,7 @@ namespace gfx { template <> std::unique_ptr Backend::Create( const Size size, gfx::Renderable::SwapBehaviour swapBehavior, const gfx::ContextMode contextMode) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return std::make_unique(size, swapBehavior, contextMode); } diff --git a/platform/glfw/glfw_gl_backend.cpp b/platform/glfw/glfw_gl_backend.cpp index 069730595..c609d4730 100644 --- a/platform/glfw/glfw_gl_backend.cpp +++ b/platform/glfw/glfw_gl_backend.cpp @@ -12,14 +12,14 @@ public: : 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(); } @@ -39,7 +39,7 @@ GLFWGLBackend::GLFWGLBackend(GLFWwindow* window_, const bool capFrameRate) }(), std::make_unique(*this)), window(window_) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); glfwMakeContextCurrent(window); if (!capFrameRate) { @@ -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); } @@ -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); @@ -84,7 +84,7 @@ void GLFWGLBackend::setSize(const mbgl::Size newSize) { } void GLFWGLBackend::swap() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); glfwSwapBuffers(window); } @@ -94,7 +94,7 @@ namespace gfx { template <> std::unique_ptr Backend::Create(GLFWwindow* window, bool capFrameRate) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return std::make_unique(window, capFrameRate); } diff --git a/platform/glfw/glfw_renderer_frontend.cpp b/platform/glfw/glfw_renderer_frontend.cpp index 493777751..a79814f01 100644 --- a/platform/glfw/glfw_renderer_frontend.cpp +++ b/platform/glfw/glfw_renderer_frontend.cpp @@ -33,7 +33,7 @@ const mbgl::TaggedScheduler& GLFWRendererFrontend::getThreadPool() const { } void GLFWRendererFrontend::render() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); assert(renderer); diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp index 636978491..ecb571d2b 100644 --- a/platform/glfw/glfw_view.cpp +++ b/platform/glfw/glfw_view.cpp @@ -86,7 +86,7 @@ class SnapshotObserver final : public mbgl::MapSnapshotterObserver { public: ~SnapshotObserver() override = default; void onDidFinishLoadingStyle() override { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (didFinishLoadingStyleCallback) { didFinishLoadingStyleCallback(); @@ -97,7 +97,7 @@ public: namespace { void addFillExtrusionLayer(mbgl::style::Style &style, bool visible) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); using namespace mbgl::style; using namespace mbgl::style::expression::dsl; @@ -144,7 +144,7 @@ GLFWView::GLFWView(bool fullscreen_, snapshotterObserver(std::make_unique()), mapResourceOptions(resourceOptions.clone()), mapClientOptions(clientOptions.clone()) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); glfwSetErrorCallback(glfwError); @@ -285,33 +285,33 @@ GLFWView::GLFWView(bool fullscreen_, } GLFWView::~GLFWView() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); glfwDestroyWindow(window); glfwTerminate(); } void GLFWView::setMap(mbgl::Map *map_) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); map = map_; map->addAnnotationImage(makeImage("default_marker", 22, 22, 1)); } void GLFWView::setRenderFrontend(GLFWRendererFrontend *rendererFrontend_) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); rendererFrontend = rendererFrontend_; } mbgl::gfx::RendererBackend &GLFWView::getRendererBackend() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return backend->getRendererBackend(); } void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action, int mods) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); auto *view = reinterpret_cast(glfwGetWindowUserPointer(window)); @@ -613,7 +613,7 @@ struct Interpolator { } // namespace mbgl void GLFWView::updateFreeCameraDemo() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); const mbgl::LatLng trainStartPos = {60.171367, 24.941359}; const mbgl::LatLng trainEndPos = {60.185147, 24.936668}; @@ -662,7 +662,7 @@ std::unique_ptr GLFWView::makeImage(const std::string &id, int width, int height, float pixelRatio) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); const int r = static_cast(255 * (static_cast(std::rand()) / RAND_MAX)); const int g = static_cast(255 * (static_cast(std::rand()) / RAND_MAX)); @@ -709,7 +709,7 @@ void GLFWView::nextOrientation() { } void GLFWView::addRandomCustomPointAnnotations(int count) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); for (int i = 0; i < count; i++) { static int spriteID = 1; @@ -721,7 +721,7 @@ void GLFWView::addRandomCustomPointAnnotations(int count) { } void GLFWView::addRandomPointAnnotations(int count) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); for (int i = 0; i < count; ++i) { annotationIDs.push_back(map->addAnnotation(mbgl::SymbolAnnotation{makeRandomPoint(), "default_marker"})); @@ -729,7 +729,7 @@ void GLFWView::addRandomPointAnnotations(int count) { } void GLFWView::addRandomLineAnnotations(int count) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); for (int i = 0; i < count; ++i) { mbgl::LineString lineString; @@ -741,7 +741,7 @@ void GLFWView::addRandomLineAnnotations(int count) { } void GLFWView::addRandomShapeAnnotations(int count) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); for (int i = 0; i < count; ++i) { mbgl::Polygon triangle; @@ -752,7 +752,7 @@ void GLFWView::addRandomShapeAnnotations(int count) { } void GLFWView::addAnimatedAnnotation() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); const double started = glfwGetTime(); animatedAnnotationIDs.push_back(map->addAnnotation(mbgl::SymbolAnnotation{{0, 0}, "default_marker"})); @@ -760,7 +760,7 @@ void GLFWView::addAnimatedAnnotation() { } void GLFWView::updateAnimatedAnnotations() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); const double time = glfwGetTime(); for (size_t i = 0; i < animatedAnnotationIDs.size(); i++) { @@ -793,7 +793,7 @@ void GLFWView::cycleDebugOptions() { } void GLFWView::clearAnnotations() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); for (const auto &id : annotationIDs) { map->removeAnnotation(id); @@ -818,7 +818,7 @@ void GLFWView::popAnnotation() { } void GLFWView::makeSnapshot(bool withOverlay) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (!snapshotter || snapshotter->getStyleURL() != map->getStyle().getURL()) { snapshotter = std::make_unique(map->getMapOptions().size(), @@ -860,7 +860,7 @@ void GLFWView::makeSnapshot(bool withOverlay) { } void GLFWView::onScroll(GLFWwindow *window, double /*xOffset*/, double yOffset) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); auto *view = reinterpret_cast(glfwGetWindowUserPointer(window)); double delta = yOffset * 40; @@ -890,7 +890,7 @@ void GLFWView::onScroll(GLFWwindow *window, double /*xOffset*/, double yOffset) } void GLFWView::onWindowResize(GLFWwindow *window, int width, int height) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); auto *view = reinterpret_cast(glfwGetWindowUserPointer(window)); view->width = width; @@ -905,7 +905,7 @@ void GLFWView::onWindowResize(GLFWwindow *window, int width, int height) { } void GLFWView::onFramebufferResize(GLFWwindow *window, int width, int height) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); auto *view = reinterpret_cast(glfwGetWindowUserPointer(window)); view->backend->setSize({static_cast(width), static_cast(height)}); @@ -918,7 +918,7 @@ void GLFWView::onFramebufferResize(GLFWwindow *window, int width, int height) { } void GLFWView::onMouseClick(GLFWwindow *window, int button, int action, int modifiers) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); auto *view = reinterpret_cast(glfwGetWindowUserPointer(window)); @@ -951,7 +951,7 @@ void GLFWView::onMouseClick(GLFWwindow *window, int button, int action, int modi } void GLFWView::onMouseMove(GLFWwindow *window, double x, double y) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); auto *view = reinterpret_cast(glfwGetWindowUserPointer(window)); if (view->tracking) { @@ -1013,7 +1013,7 @@ void GLFWView::onMouseMove(GLFWwindow *window, double x, double y) { } void GLFWView::onWindowFocus(GLFWwindow *window, int focused) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (focused == GLFW_FALSE) { // Focus lost. auto *view = reinterpret_cast(glfwGetWindowUserPointer(window)); @@ -1022,13 +1022,13 @@ void GLFWView::onWindowFocus(GLFWwindow *window, int focused) { } void GLFWView::run() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); auto callback = [&] { - MLN_TRACE_ZONE(GLFWView_runLoop_callback) + MLN_TRACE_ZONE(GLFWView_runLoop_callback); { - MLN_TRACE_ZONE(glfwWindowShouldClose) + MLN_TRACE_ZONE(glfwWindowShouldClose); if (glfwWindowShouldClose(window)) { runLoop.stop(); return; @@ -1036,18 +1036,18 @@ void GLFWView::run() { } { - MLN_TRACE_ZONE(glfwPollEvents) + MLN_TRACE_ZONE(glfwPollEvents); glfwPollEvents(); } if (dirty && rendererFrontend) { - MLN_TRACE_ZONE(ReRender) + MLN_TRACE_ZONE(ReRender); dirty = false; const double started = glfwGetTime(); if (animateRouteCallback) { - MLN_TRACE_ZONE(animateRouteCallback) + MLN_TRACE_ZONE(animateRouteCallback); animateRouteCallback(map); } @@ -1094,7 +1094,7 @@ mbgl::Size GLFWView::getSize() const { } void GLFWView::invalidate() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); dirty = true; glfwPostEmptyEvent(); @@ -1124,20 +1124,20 @@ void GLFWView::setChangeStyleCallback(std::function callback) { } void GLFWView::setShouldClose() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); glfwSetWindowShouldClose(window, true); glfwPostEmptyEvent(); } void GLFWView::setWindowTitle(const std::string &title) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); glfwSetWindowTitle(window, (std::string{"MapLibre Native (GLFW): "} + title).c_str()); } void GLFWView::onDidFinishLoadingStyle() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); #if defined(MLN_RENDER_BACKEND_OPENGL) && !defined(MBGL_LAYER_CUSTOM_DISABLE_ALL) puck = nullptr; @@ -1149,14 +1149,14 @@ void GLFWView::onDidFinishLoadingStyle() { } void GLFWView::toggle3DExtrusions(bool visible) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); show3DExtrusions = visible; addFillExtrusionLayer(map->getStyle(), show3DExtrusions); } void GLFWView::toggleCustomSource() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (!map->getStyle().getSource("custom")) { mbgl::style::CustomGeometrySource::Options options; @@ -1208,7 +1208,7 @@ void GLFWView::toggleCustomSource() { } void GLFWView::toggleLocationIndicatorLayer() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); #if defined(MLN_RENDER_BACKEND_OPENGL) && !defined(MBGL_LAYER_LOCATION_INDICATOR_DISABLE_ALL) puck = static_cast(map->getStyle().getLayer("puck")); @@ -1273,7 +1273,7 @@ void GLFWView::toggleLocationIndicatorLayer() { using Nanoseconds = std::chrono::nanoseconds; void GLFWView::onWillStartRenderingFrame() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); #if defined(MLN_RENDER_BACKEND_OPENGL) && !defined(MBGL_LAYER_LOCATION_INDICATOR_DISABLE_ALL) puck = static_cast(map->getStyle().getLayer("puck")); diff --git a/src/mbgl/actor/mailbox.cpp b/src/mbgl/actor/mailbox.cpp index 6c5a7dfb4..1eb83140d 100644 --- a/src/mbgl/actor/mailbox.cpp +++ b/src/mbgl/actor/mailbox.cpp @@ -73,7 +73,7 @@ bool Mailbox::isOpen() const { } void Mailbox::push(std::unique_ptr message) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); auto idleState = State::Idle; while (!state.compare_exchange_strong(idleState, State::Processing)) { if (state == State::Abandoned) { @@ -87,25 +87,27 @@ void Mailbox::push(std::unique_ptr message) { } }}; - MLN_TRACE_ZONE(push lock) - std::lock_guard pushingLock(pushingMutex); - - if (closed) { - state = State::Abandoned; - return; - } - - bool wasEmpty = false; { - MLN_TRACE_ZONE(queue lock) - std::lock_guard queueLock(queueMutex); - wasEmpty = queue.empty(); - queue.push(std::move(message)); - } + MLN_TRACE_ZONE(push_lock); + std::lock_guard pushingLock(pushingMutex); - if (wasEmpty) { - MLN_TRACE_ZONE(schedule) - scheduleToRecieve(schedulerTag); + if (closed) { + state = State::Abandoned; + return; + } + + bool wasEmpty = false; + { + MLN_TRACE_ZONE(queue_lock); + std::lock_guard queueLock(queueMutex); + wasEmpty = queue.empty(); + queue.push(std::move(message)); + } + + if (wasEmpty) { + MLN_TRACE_ZONE(schedule); + scheduleToRecieve(schedulerTag); + } } } diff --git a/src/mbgl/annotation/render_annotation_source.cpp b/src/mbgl/annotation/render_annotation_source.cpp index 5e0325939..e84a89c41 100644 --- a/src/mbgl/annotation/render_annotation_source.cpp +++ b/src/mbgl/annotation/render_annotation_source.cpp @@ -26,7 +26,7 @@ void RenderAnnotationSource::update(Immutable baseImpl_, const bool needsRendering, const bool needsRelayout, const TileParameters& parameters) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); std::swap(baseImpl, baseImpl_); diff --git a/src/mbgl/gl/buffer_allocator.cpp b/src/mbgl/gl/buffer_allocator.cpp index bd02788bd..975af80c6 100644 --- a/src/mbgl/gl/buffer_allocator.cpp +++ b/src/mbgl/gl/buffer_allocator.cpp @@ -300,7 +300,7 @@ public: // Look for buffers that either have zero living references or equal or under FragmentationThresh // references. In the latter case, attempt to relocate these allocations to more utilized buffers. void defragment(const std::shared_ptr& fence) override { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (buffers.size() == 0) { return; } diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp index 18a17f588..6a34eabc9 100644 --- a/src/mbgl/gl/context.cpp +++ b/src/mbgl/gl/context.cpp @@ -113,7 +113,7 @@ Context::~Context() noexcept { } void Context::beginFrame() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); backend.getThreadPool().runRenderJobs(); @@ -133,7 +133,7 @@ void Context::beginFrame() { } void Context::endFrame() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); #if MLN_DRAWABLE_RENDERER if (!frameInFlightFence) { @@ -145,7 +145,7 @@ void Context::endFrame() { } void Context::initializeExtensions(const std::function& getProcAddress) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (const auto* extensions = reinterpret_cast(MBGL_CHECK_ERROR(glGetString(GL_EXTENSIONS)))) { auto fn = [&](std::initializer_list> probes) -> ProcAddress { @@ -175,7 +175,7 @@ void Context::initializeExtensions(const std::function Context::createTextureResource(const Size size, const gfx::TexturePixelType format, const gfx::TextureChannelDataType type) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); auto obj = createUniqueTexture(); int textureByteSize = gl::TextureResource::getStorageSize(size, format, type); @@ -340,11 +340,11 @@ std::unique_ptr Context::createTextureResource(const Size std::unique_ptr Context::createRenderbufferResource(const gfx::RenderbufferPixelType type, const Size size) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); RenderbufferID id = 0; MBGL_CHECK_ERROR(glGenRenderbuffers(1, &id)); - MLN_TRACE_ALLOC_RT(id, renderBufferByteSize(type, size)) + MLN_TRACE_ALLOC_RT(id, renderBufferByteSize(type, size)); // NOLINTNEXTLINE(performance-move-const-arg) UniqueRenderbuffer renderbuffer{std::move(id), {this}}; @@ -359,8 +359,8 @@ std::unique_ptr Context::createRenderbufferResource(c std::unique_ptr Context::readFramebuffer(const Size size, const gfx::TexturePixelType format, const bool flip) { - MLN_TRACE_FUNC() - MLN_TRACE_FUNC_GL() + MLN_TRACE_FUNC(); + MLN_TRACE_FUNC_GL(); const size_t stride = size.width * (format == gfx::TexturePixelType::RGBA ? 4 : 1); auto data = std::make_unique(stride * size.height); @@ -388,7 +388,7 @@ std::unique_ptr Context::readFramebuffer(const Size size, namespace { void checkFramebuffer() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); GLenum status = MBGL_CHECK_ERROR(glCheckFramebufferStatus(GL_FRAMEBUFFER)); if (status != GL_FRAMEBUFFER_COMPLETE) { @@ -421,8 +421,8 @@ void checkFramebuffer() { } void bindDepthStencilRenderbuffer(const gfx::Renderbuffer& depthStencil) { - MLN_TRACE_FUNC() - MLN_TRACE_FUNC_GL() + MLN_TRACE_FUNC(); + MLN_TRACE_FUNC_GL(); auto& depthStencilResource = depthStencil.getResource(); #ifdef GL_DEPTH_STENCIL_ATTACHMENT @@ -441,7 +441,7 @@ void bindDepthStencilRenderbuffer(const gfx::Renderbuffer& color, const gfx::Renderbuffer& depthStencil) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (color.getSize() != depthStencil.getSize()) { throw std::runtime_error("Renderbuffer size mismatch"); @@ -458,7 +458,7 @@ Framebuffer Context::createFramebuffer( } Framebuffer Context::createFramebuffer(const gfx::Renderbuffer& color) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); auto fbo = createFramebuffer(); bindFramebuffer = fbo; @@ -471,7 +471,7 @@ Framebuffer Context::createFramebuffer(const gfx::Renderbuffer& depthStencil) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (color.size != depthStencil.getSize()) { throw std::runtime_error("Renderbuffer size mismatch"); @@ -486,7 +486,7 @@ Framebuffer Context::createFramebuffer( } Framebuffer Context::createFramebuffer(const gfx::Texture& color) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); auto fbo = createFramebuffer(); bindFramebuffer = fbo; @@ -498,7 +498,7 @@ Framebuffer Context::createFramebuffer(const gfx::Texture& color) { Framebuffer Context::createFramebuffer(const gfx::Texture& color, const gfx::Renderbuffer& depth) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (color.size != depth.getSize()) { throw std::runtime_error("Renderbuffer size mismatch"); } @@ -516,19 +516,19 @@ Framebuffer Context::createFramebuffer(const gfx::Texture& color, std::unique_ptr Context::createOffscreenTexture(const Size size, const gfx::TextureChannelDataType type) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return std::make_unique(*this, size, type); } std::unique_ptr Context::createDrawScopeResource() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return std::make_unique(createVertexArray()); } void Context::reset() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); std::copy(pooledTextures.begin(), pooledTextures.end(), std::back_inserter(abandonedTextures)); pooledTextures.resize(0); @@ -537,8 +537,8 @@ void Context::reset() { #if MLN_DRAWABLE_RENDERER void Context::resetState(gfx::DepthMode depthMode, gfx::ColorMode colorMode) { - MLN_TRACE_FUNC() - MLN_TRACE_FUNC_GL() + MLN_TRACE_FUNC(); + MLN_TRACE_FUNC_GL(); // Reset GL state to a known state so the CustomLayer always has a clean slate. bindVertexArray = value::BindVertexArray::Default; @@ -552,7 +552,7 @@ bool Context::emplaceOrUpdateUniformBuffer(gfx::UniformBufferPtr& buffer, const void* data, std::size_t size, bool persistent) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (buffer) { buffer->update(data, size); @@ -564,7 +564,7 @@ bool Context::emplaceOrUpdateUniformBuffer(gfx::UniformBufferPtr& buffer, } void Context::bindGlobalUniformBuffers(gfx::RenderPass&) const noexcept { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); for (size_t id = 0; id < globalUniformBuffers.allocatedSize(); id++) { const auto& globalUniformBuffer = globalUniformBuffers.get(id); @@ -580,7 +580,7 @@ void Context::bindGlobalUniformBuffers(gfx::RenderPass&) const noexcept { } void Context::unbindGlobalUniformBuffers(gfx::RenderPass&) const noexcept { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); for (size_t id = 0; id < globalUniformBuffers.allocatedSize(); id++) { const auto& globalUniformBuffer = globalUniformBuffers.get(id); @@ -592,7 +592,7 @@ void Context::unbindGlobalUniformBuffers(gfx::RenderPass&) const noexcept { #endif void Context::setDirtyState() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); // Note: does not set viewport/scissorTest/bindFramebuffer to dirty // since they are handled separately in the view object. @@ -632,19 +632,19 @@ void Context::setDirtyState() { #if MLN_DRAWABLE_RENDERER gfx::UniqueDrawableBuilder Context::createDrawableBuilder(std::string name) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return std::make_unique(std::move(name)); } gfx::UniformBufferPtr Context::createUniformBuffer(const void* data, std::size_t size, bool /*persistent*/) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return std::make_shared(data, size, *uboAllocator); } gfx::ShaderProgramBasePtr Context::getGenericShader(gfx::ShaderRegistry& shaders, const std::string& name) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); auto shaderGroup = shaders.getShaderGroup(name); if (!shaderGroup) { @@ -654,31 +654,31 @@ gfx::ShaderProgramBasePtr Context::getGenericShader(gfx::ShaderRegistry& shaders } TileLayerGroupPtr Context::createTileLayerGroup(int32_t layerIndex, std::size_t initialCapacity, std::string name) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return std::make_shared(layerIndex, initialCapacity, std::move(name)); } LayerGroupPtr Context::createLayerGroup(int32_t layerIndex, std::size_t initialCapacity, std::string name) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return std::make_shared(layerIndex, initialCapacity, std::move(name)); } gfx::Texture2DPtr Context::createTexture2D() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return std::make_shared(*this); } RenderTargetPtr Context::createRenderTarget(const Size size, const gfx::TextureChannelDataType type) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return std::make_shared(*this, size, type); } Framebuffer Context::createFramebuffer(const gfx::Texture2D& color) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); auto fbo = createFramebuffer(); bindFramebuffer = fbo; @@ -698,8 +698,8 @@ gfx::VertexAttributeArrayPtr Context::createVertexAttributeArray() const { #endif void Context::clear(std::optional color, std::optional depth, std::optional stencil) { - MLN_TRACE_FUNC() - MLN_TRACE_FUNC_GL() + MLN_TRACE_FUNC(); + MLN_TRACE_FUNC_GL(); GLbitfield mask = 0; @@ -788,7 +788,7 @@ void Context::setColorMode(const gfx::ColorMode& color) { } std::unique_ptr Context::createCommandEncoder() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); backend.updateAssumedState(); if (backend.contextIsShared()) { @@ -798,8 +798,8 @@ std::unique_ptr Context::createCommandEncoder() { } void Context::finish() { - MLN_TRACE_FUNC() - MLN_TRACE_FUNC_GL() + MLN_TRACE_FUNC(); + MLN_TRACE_FUNC_GL(); MBGL_CHECK_ERROR(glFinish()); } @@ -811,8 +811,8 @@ std::shared_ptr Context::getCurrentFrameFence() const { #endif void Context::draw(const gfx::DrawMode& drawMode, std::size_t indexOffset, std::size_t indexLength) { - MLN_TRACE_FUNC() - MLN_TRACE_FUNC_GL() + MLN_TRACE_FUNC(); + MLN_TRACE_FUNC_GL(); switch (drawMode.type) { case gfx::DrawModeType::Points: @@ -835,7 +835,7 @@ void Context::draw(const gfx::DrawMode& drawMode, std::size_t indexOffset, std:: } void Context::performCleanup() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); #ifndef NDEBUG // In debug builds, un-bind all texture units so that any incorrect use results in an // error rather than using whatever texture happened to have been bound previously. @@ -919,8 +919,8 @@ void Context::performCleanup() { } void Context::reduceMemoryUsage() { - MLN_TRACE_FUNC() - MLN_TRACE_FUNC_GL() + MLN_TRACE_FUNC(); + MLN_TRACE_FUNC_GL(); performCleanup(); @@ -940,8 +940,8 @@ void Context::visualizeDepthBuffer([[maybe_unused]] const float depthRangeSize) #endif void Context::clearStencilBuffer(const int32_t bits) { - MLN_TRACE_FUNC() - MLN_TRACE_FUNC_GL() + MLN_TRACE_FUNC(); + MLN_TRACE_FUNC_GL(); MBGL_CHECK_ERROR(glClearStencil(bits)); MBGL_CHECK_ERROR(glClear(GL_STENCIL_BUFFER_BIT)); diff --git a/src/mbgl/gl/fence.cpp b/src/mbgl/gl/fence.cpp index 28664ac36..350939e6c 100644 --- a/src/mbgl/gl/fence.cpp +++ b/src/mbgl/gl/fence.cpp @@ -26,7 +26,7 @@ std::string glErrors() { Fence::Fence() {} Fence::~Fence() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (fence) { glDeleteSync(fence); @@ -34,14 +34,14 @@ Fence::~Fence() { } void Fence::insert() noexcept { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); assert(!fence); fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); } bool Fence::isSignaled() const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (!fence) { return false; diff --git a/src/mbgl/gl/index_buffer_resource.cpp b/src/mbgl/gl/index_buffer_resource.cpp index b09e0b7ca..c5b558ecd 100644 --- a/src/mbgl/gl/index_buffer_resource.cpp +++ b/src/mbgl/gl/index_buffer_resource.cpp @@ -7,10 +7,12 @@ namespace gl { IndexBufferResource::IndexBufferResource(UniqueBuffer&& buffer_, int byteSize_) : buffer(std::move(buffer_)), - byteSize(byteSize_){MLN_TRACE_ALLOC_INDEX_BUFFER(buffer.get(), byteSize)} + byteSize(byteSize_) { + MLN_TRACE_ALLOC_INDEX_BUFFER(buffer.get(), byteSize); +} - IndexBufferResource::~IndexBufferResource() noexcept { - MLN_TRACE_FREE_INDEX_BUFFER(buffer.get()) +IndexBufferResource::~IndexBufferResource() noexcept { + MLN_TRACE_FREE_INDEX_BUFFER(buffer.get()); auto& stats = buffer.get_deleter().context.renderingStats(); stats.memIndexBuffers -= byteSize; assert(stats.memIndexBuffers >= 0); diff --git a/src/mbgl/gl/layer_group_gl.cpp b/src/mbgl/gl/layer_group_gl.cpp index 4aca74fbe..9e4ada2ec 100644 --- a/src/mbgl/gl/layer_group_gl.cpp +++ b/src/mbgl/gl/layer_group_gl.cpp @@ -28,9 +28,6 @@ void TileLayerGroupGL::upload(gfx::UploadPass& uploadPass) { return; } - MLN_TRACE_FUNC() - MLN_ZONE_STR(name) - visitDrawables([&](gfx::Drawable& drawable) { if (!drawable.getEnabled()) { return; @@ -56,7 +53,7 @@ void TileLayerGroupGL::render(RenderOrchestrator&, PaintParameters& parameters) return; } - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); auto& context = static_cast(parameters.context); @@ -69,7 +66,7 @@ void TileLayerGroupGL::render(RenderOrchestrator&, PaintParameters& parameters) gfx::StencilMode stencilMode3d; if (getDrawableCount()) { - MLN_TRACE_ZONE(clip masks) + MLN_TRACE_ZONE(clip masks); #if !defined(NDEBUG) const auto label_clip = getName() + (getName().empty() ? "" : "-") + "tile-clip-masks"; const auto debugGroupClip = parameters.encoder->createDebugGroup(label_clip.c_str()); @@ -158,7 +155,7 @@ void TileLayerGroupGL::bindUniformBuffers() const { } void TileLayerGroupGL::unbindUniformBuffers() const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); for (size_t id = 0; id < uniformBuffers.allocatedSize(); id++) { const auto& uniformBuffer = uniformBuffers.get(id); if (!uniformBuffer) continue; diff --git a/src/mbgl/gl/renderbuffer_resource.cpp b/src/mbgl/gl/renderbuffer_resource.cpp index d6e159078..372aadb58 100644 --- a/src/mbgl/gl/renderbuffer_resource.cpp +++ b/src/mbgl/gl/renderbuffer_resource.cpp @@ -6,7 +6,7 @@ namespace mbgl { namespace gl { RenderbufferResource::~RenderbufferResource() noexcept { - MLN_TRACE_FREE_RT(renderbuffer.get()) + MLN_TRACE_FREE_RT(renderbuffer.get()); } } // namespace gl diff --git a/src/mbgl/gl/renderer_backend.cpp b/src/mbgl/gl/renderer_backend.cpp index 93e993fe2..fa8badc2d 100644 --- a/src/mbgl/gl/renderer_backend.cpp +++ b/src/mbgl/gl/renderer_backend.cpp @@ -23,7 +23,7 @@ RendererBackend::RendererBackend(const gfx::ContextMode contextMode_, const Tagg : gfx::RendererBackend(contextMode_, threadPool_) {} std::unique_ptr RendererBackend::createContext() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); auto result = std::make_unique( *this); // Tagged background thread pool will be owned by the RendererBackend @@ -33,13 +33,13 @@ std::unique_ptr RendererBackend::createContext() { } PremultipliedImage RendererBackend::readFramebuffer(const Size& size) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return getContext().readFramebuffer(size); } void RendererBackend::assumeFramebufferBinding(const gl::FramebufferID fbo) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); getContext().bindFramebuffer.setCurrentValue(fbo); if (fbo != ImplicitFramebufferBinding) { @@ -48,27 +48,27 @@ void RendererBackend::assumeFramebufferBinding(const gl::FramebufferID fbo) { } void RendererBackend::assumeViewport(int32_t x, int32_t y, const Size& size) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); getContext().viewport.setCurrentValue({x, y, size}); assert(gl::value::Viewport::Get() == getContext().viewport.getCurrentValue()); } void RendererBackend::assumeScissorTest(bool enabled) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); getContext().scissorTest.setCurrentValue(enabled); assert(gl::value::ScissorTest::Get() == getContext().scissorTest.getCurrentValue()); } bool RendererBackend::implicitFramebufferBound() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return getContext().bindFramebuffer.getCurrentValue() == ImplicitFramebufferBinding; } void RendererBackend::setFramebufferBinding(const gl::FramebufferID fbo) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); getContext().bindFramebuffer = fbo; if (fbo != ImplicitFramebufferBinding) { @@ -77,14 +77,14 @@ void RendererBackend::setFramebufferBinding(const gl::FramebufferID fbo) { } void RendererBackend::setViewport(int32_t x, int32_t y, const Size& size) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); getContext().viewport = {x, y, size}; assert(gl::value::Viewport::Get() == getContext().viewport.getCurrentValue()); } void RendererBackend::setScissorTest(bool enabled) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); getContext().scissorTest = enabled; assert(gl::value::ScissorTest::Get() == getContext().scissorTest.getCurrentValue()); @@ -99,7 +99,7 @@ RendererBackend::~RendererBackend() = default; /// @param programParameters ProgramParameters used to initialize each instance template void registerTypes(gfx::ShaderRegistry& registry, const ProgramParameters& programParameters) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); /// The following fold expression will create a shader for every type /// in the parameter pack and register it with the shader registry. @@ -118,7 +118,7 @@ void registerTypes(gfx::ShaderRegistry& registry, const ProgramParameters& progr } void RendererBackend::initShaders(gfx::ShaderRegistry& shaders, const ProgramParameters& programParameters) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); registerTypesrenderingStats(); - MLN_TRACE_FREE_TEXTURE(texture.get()) + MLN_TRACE_FREE_TEXTURE(texture.get()); stats.memTextures -= byteSize; assert(stats.memTextures >= 0); } diff --git a/src/mbgl/gl/uniform_buffer_gl.cpp b/src/mbgl/gl/uniform_buffer_gl.cpp index d31b42272..e678976d3 100644 --- a/src/mbgl/gl/uniform_buffer_gl.cpp +++ b/src/mbgl/gl/uniform_buffer_gl.cpp @@ -32,7 +32,7 @@ UniformBufferGL::UniformBufferGL(const void* data_, std::size_t size_, IBufferAl uniqueDebugId(generateDebugId()), #endif managedBuffer(allocator_, this) { - MLN_TRACE_ALLOC_CONST_BUFFER(uniqueDebugId, size_) + MLN_TRACE_ALLOC_CONST_BUFFER(uniqueDebugId, size_); if (size_ > managedBuffer.allocator.pageSize()) { // Buffer is very large, won't fit in the provided allocator MBGL_CHECK_ERROR(glGenBuffers(1, &localID)); @@ -66,7 +66,7 @@ UniformBufferGL::UniformBufferGL(const UniformBufferGL& other) uniqueDebugId(generateDebugId()), #endif managedBuffer(other.managedBuffer.allocator, this) { - MLN_TRACE_ALLOC_CONST_BUFFER(uniqueDebugId, other.size) + MLN_TRACE_ALLOC_CONST_BUFFER(uniqueDebugId, other.size); managedBuffer.setOwner(this); if (other.isManagedAllocation) { managedBuffer.allocate(other.managedBuffer.getContents().data(), other.size); @@ -83,7 +83,7 @@ UniformBufferGL::~UniformBufferGL() { #ifdef MLN_TRACY_ENABLE assert(uniqueDebugId > 0); #endif - MLN_TRACE_FREE_CONST_BUFFER(uniqueDebugId) + MLN_TRACE_FREE_CONST_BUFFER(uniqueDebugId); if (isManagedAllocation) { return; } diff --git a/src/mbgl/gl/vertex_buffer_resource.cpp b/src/mbgl/gl/vertex_buffer_resource.cpp index 2bc8c28af..d1d71bb74 100644 --- a/src/mbgl/gl/vertex_buffer_resource.cpp +++ b/src/mbgl/gl/vertex_buffer_resource.cpp @@ -7,10 +7,12 @@ namespace gl { VertexBufferResource::VertexBufferResource(UniqueBuffer&& buffer_, int byteSize_) : buffer(std::move(buffer_)), - byteSize(byteSize_){MLN_TRACE_ALLOC_VERTEX_BUFFER(buffer.get(), byteSize)} + byteSize(byteSize_) { + MLN_TRACE_ALLOC_VERTEX_BUFFER(buffer.get(), byteSize); +} - VertexBufferResource::~VertexBufferResource() noexcept { - MLN_TRACE_FREE_VERTEX_BUFFER(buffer.get()) +VertexBufferResource::~VertexBufferResource() noexcept { + MLN_TRACE_FREE_VERTEX_BUFFER(buffer.get()); auto& stats = buffer.get_deleter().context.renderingStats(); stats.memVertexBuffers -= byteSize; assert(stats.memVertexBuffers >= 0); diff --git a/src/mbgl/renderer/backend_scope.cpp b/src/mbgl/renderer/backend_scope.cpp index aeb1df89e..0ce476604 100644 --- a/src/mbgl/renderer/backend_scope.cpp +++ b/src/mbgl/renderer/backend_scope.cpp @@ -23,7 +23,7 @@ BackendScope::BackendScope(RendererBackend& backend_, ScopeType scopeType_) nextScope(nullptr), backend(backend_), scopeType(scopeType_) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (priorScope) { assert(priorScope->nextScope == nullptr); @@ -37,7 +37,7 @@ BackendScope::BackendScope(RendererBackend& backend_, ScopeType scopeType_) } BackendScope::~BackendScope() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); assert(nextScope == nullptr); deactivate(); @@ -53,7 +53,7 @@ BackendScope::~BackendScope() { } void BackendScope::activate() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (scopeType == ScopeType::Explicit && !(priorScope && this->backend == priorScope->backend) && !(nextScope && this->backend == nextScope->backend)) { diff --git a/src/mbgl/renderer/image_manager.cpp b/src/mbgl/renderer/image_manager.cpp index a7b0d9e94..c2b7bca93 100644 --- a/src/mbgl/renderer/image_manager.cpp +++ b/src/mbgl/renderer/image_manager.cpp @@ -192,17 +192,19 @@ void ImageManager::reduceMemoryUse() { void ImageManager::reduceMemoryUseIfCacheSizeExceedsLimit() { if (requestedImagesCacheSize > util::DEFAULT_ON_DEMAND_IMAGES_CACHE_SIZE) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); reduceMemoryUse(); } } std::set ImageManager::getAvailableImages() const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); std::lock_guard readWriteLock(rwLock); - MLN_TRACE_ZONE(copy) - return availableImages; + { + MLN_TRACE_ZONE(copy); + return availableImages; + } } void ImageManager::clear() { diff --git a/src/mbgl/renderer/render_orchestrator.cpp b/src/mbgl/renderer/render_orchestrator.cpp index 40e673a30..4d9ccd952 100644 --- a/src/mbgl/renderer/render_orchestrator.cpp +++ b/src/mbgl/renderer/render_orchestrator.cpp @@ -85,7 +85,7 @@ public: updateSymbolOpacities(updateSymbolOpacities_) {} void prepare() override { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); for (auto it = layersNeedPlacement.rbegin(); it != layersNeedPlacement.rend(); ++it) { placement->updateLayerBuckets(*it, parameters->transformParams.state, updateSymbolOpacities); @@ -133,7 +133,7 @@ RenderOrchestrator::RenderOrchestrator(bool backgroundLayerAsColor_, } RenderOrchestrator::~RenderOrchestrator() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (contextLost) { // Signal all RenderLayers that the context was lost @@ -158,7 +158,7 @@ void RenderOrchestrator::setObserver(RendererObserver* observer_) { std::unique_ptr RenderOrchestrator::createRenderTree( const std::shared_ptr& updateParameters) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); const auto startTime = util::MonotonicTimer::now().count(); @@ -371,8 +371,8 @@ std::unique_ptr RenderOrchestrator::createRenderTree( // Update all sources and initialize renderItems. for (const auto& sourceImpl : *sourceImpls) { - MLN_TRACE_ZONE(update source) - MLN_ZONE_STR(sourceImpl->id) + MLN_TRACE_ZONE(update source); + MLN_ZONE_STR(sourceImpl->id); RenderSource* source = renderSources.at(sourceImpl->id).get(); bool sourceNeedsRendering = false; @@ -454,8 +454,8 @@ std::unique_ptr RenderOrchestrator::createRenderTree( auto opaquePassCutOffEstimation = layerRenderItems.size(); for (auto& renderItem : layerRenderItems) { RenderLayer& renderLayer = renderItem.layer; - MLN_TRACE_ZONE(prepare layer) - MLN_ZONE_STR(renderLayer.getID()) + MLN_TRACE_ZONE(prepare layer); + MLN_ZONE_STR(renderLayer.getID()); renderLayer.prepare( {renderItem.source, *imageManager, *patternAtlas, *lineAtlas, updateParameters->transformState}); @@ -565,7 +565,7 @@ std::unique_ptr RenderOrchestrator::createRenderTree( std::vector RenderOrchestrator::queryRenderedFeatures(const ScreenLineString& geometry, const RenderedQueryOptions& options) const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); std::unordered_map layers; if (options.layerIDs) { @@ -587,7 +587,7 @@ void RenderOrchestrator::queryRenderedSymbols(std::unordered_map& layers, const RenderedQueryOptions& options) const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); const auto hasCrossTileIndex = [](const auto& pair) { return pair.second->baseImpl->getTypeInfo()->crossTileIndex == style::LayerTypeInfo::CrossTileIndex::Required; @@ -637,7 +637,7 @@ std::vector RenderOrchestrator::queryRenderedFeatures( const ScreenLineString& geometry, const RenderedQueryOptions& options, const std::unordered_map& layers) const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); std::unordered_set sourceIDs; std::unordered_map filteredLayers; @@ -688,7 +688,7 @@ std::vector RenderOrchestrator::queryRenderedFeatures( } std::vector RenderOrchestrator::queryShapeAnnotations(const ScreenLineString& geometry) const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); assert(LayerManager::annotationsEnabled); std::unordered_map shapeAnnotationLayers; @@ -710,7 +710,7 @@ std::vector RenderOrchestrator::queryShapeAnnotations(const ScreenLineS std::vector RenderOrchestrator::querySourceFeatures(const std::string& sourceID, const SourceQueryOptions& options) const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); const RenderSource* source = getRenderSource(sourceID); if (!source) return {}; @@ -724,7 +724,7 @@ FeatureExtensionValue RenderOrchestrator::queryFeatureExtensions( const std::string& extension, const std::string& extensionField, const std::optional>& args) const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (RenderSource* renderSource = getRenderSource(sourceID)) { return renderSource->queryFeatureExtensions(feature, extension, extensionField, args); @@ -736,7 +736,7 @@ void RenderOrchestrator::setFeatureState(const std::string& sourceID, const std::optional& sourceLayerID, const std::string& featureID, const FeatureState& state) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (RenderSource* renderSource = getRenderSource(sourceID)) { renderSource->setFeatureState(sourceLayerID, featureID, state); @@ -747,7 +747,7 @@ void RenderOrchestrator::getFeatureState(FeatureState& state, const std::string& sourceID, const std::optional& sourceLayerID, const std::string& featureID) const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (RenderSource* renderSource = getRenderSource(sourceID)) { renderSource->getFeatureState(state, sourceLayerID, featureID); @@ -758,7 +758,7 @@ void RenderOrchestrator::removeFeatureState(const std::string& sourceID, const std::optional& sourceLayerID, const std::optional& featureID, const std::optional& stateKey) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (RenderSource* renderSource = getRenderSource(sourceID)) { renderSource->removeFeatureState(sourceLayerID, featureID, stateKey); @@ -778,7 +778,7 @@ bool RenderOrchestrator::getTileCacheEnabled() const { } void RenderOrchestrator::reduceMemoryUse() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); filteredLayersForSource.shrink_to_fit(); for (const auto& entry : renderSources) { @@ -789,7 +789,7 @@ void RenderOrchestrator::reduceMemoryUse() { } void RenderOrchestrator::dumpDebugLogs() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); for (const auto& entry : renderSources) { entry.second->dumpDebugLogs(); @@ -846,7 +846,7 @@ bool RenderOrchestrator::hasTransitions(TimePoint timePoint) const { } bool RenderOrchestrator::isLoaded() const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); // do the simple boolean check before iterating over all the tiles in all the sources if (!imageManager->isLoaded()) { @@ -863,7 +863,7 @@ bool RenderOrchestrator::isLoaded() const { } void RenderOrchestrator::clearData() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (!sourceImpls->empty()) sourceImpls = makeMutable>>(); if (!layerImpls->empty()) layerImpls = makeMutable>>(); @@ -899,7 +899,7 @@ void RenderOrchestrator::addChanges(UniqueChangeRequestVec& changes) { } void RenderOrchestrator::updateLayerIndex(LayerGroupBasePtr layerGroup, const int32_t newIndex) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (!layerGroup || layerGroup->getLayerIndex() == newIndex) { return; @@ -918,7 +918,7 @@ void RenderOrchestrator::updateLayerIndex(LayerGroupBasePtr layerGroup, const in } bool RenderOrchestrator::addLayerGroup(LayerGroupBasePtr layerGroup) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); const auto index = layerGroup->getLayerIndex(); const auto range = layerGroupsByLayerIndex.equal_range(index); @@ -940,7 +940,7 @@ bool RenderOrchestrator::addLayerGroup(LayerGroupBasePtr layerGroup) { } bool RenderOrchestrator::removeLayerGroup(const LayerGroupBasePtr& layerGroup) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (!layerGroup) { return false; @@ -960,7 +960,7 @@ size_t RenderOrchestrator::numLayerGroups() const noexcept { } int32_t RenderOrchestrator::maxLayerIndex() const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (!layerGroupsByLayerIndex.empty()) { assert(layerGroupsByLayerIndex.crbegin()->first == layerGroupsByLayerIndex.crbegin()->second->getLayerIndex()); @@ -974,7 +974,7 @@ void RenderOrchestrator::updateLayers(gfx::ShaderRegistry& shaders, const TransformState& state, const std::shared_ptr& updateParameters, const RenderTree& renderTree) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); const bool isMapModeContinuous = updateParameters->mode == MapMode::Continuous; const auto transitionOptions = isMapModeContinuous ? updateParameters->transitionOptions @@ -1036,7 +1036,7 @@ void RenderOrchestrator::updateDebugLayerGroups(const RenderTree& renderTree, Pa void RenderOrchestrator::onGlyphsError(const FontStack& fontStack, const GlyphRange& glyphRange, std::exception_ptr error) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); Log::Error(Event::Style, "Failed to load glyph range " + std::to_string(glyphRange.first) + "-" + @@ -1046,7 +1046,7 @@ void RenderOrchestrator::onGlyphsError(const FontStack& fontStack, } void RenderOrchestrator::onTileError(RenderSource& source, const OverscaledTileID& tileID, std::exception_ptr error) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); Log::Error(Event::Style, "Failed to load tile " + util::toString(tileID) + " for source " + source.baseImpl->id + ": " + @@ -1055,19 +1055,19 @@ void RenderOrchestrator::onTileError(RenderSource& source, const OverscaledTileI } void RenderOrchestrator::onTileChanged(RenderSource&, const OverscaledTileID&) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); observer->onInvalidate(); } void RenderOrchestrator::onStyleImageMissing(const std::string& id, const std::function& done) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); observer->onStyleImageMissing(id, done); } void RenderOrchestrator::onRemoveUnusedStyleImages(const std::vector& unusedImageIDs) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); observer->onRemoveUnusedStyleImages(unusedImageIDs); } diff --git a/src/mbgl/renderer/renderer.cpp b/src/mbgl/renderer/renderer.cpp index f831f404d..0df78b071 100644 --- a/src/mbgl/renderer/renderer.cpp +++ b/src/mbgl/renderer/renderer.cpp @@ -30,7 +30,7 @@ void Renderer::setObserver(RendererObserver* observer) { } void Renderer::render(const std::shared_ptr& updateParameters) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); assert(updateParameters); if (auto renderTree = impl->orchestrator.createRenderTree(updateParameters)) { renderTree->prepare(); diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp index 07aa75dfc..3bef358d2 100644 --- a/src/mbgl/renderer/renderer_impl.cpp +++ b/src/mbgl/renderer/renderer_impl.cpp @@ -74,7 +74,7 @@ void Renderer::Impl::setObserver(RendererObserver* observer_) { void Renderer::Impl::render(const RenderTree& renderTree, [[maybe_unused]] const std::shared_ptr& updateParameters) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); auto& context = backend.getContext(); #if MLN_RENDER_BACKEND_METAL if constexpr (EnableMetalCapture) { @@ -542,7 +542,7 @@ void Renderer::Impl::render(const RenderTree& renderTree, } frameCount += 1; - MLN_END_FRAME() + MLN_END_FRAME(); } void Renderer::Impl::reduceMemoryUse() { diff --git a/src/mbgl/renderer/sources/render_tile_source.cpp b/src/mbgl/renderer/sources/render_tile_source.cpp index ed203ddfb..d52e67c88 100644 --- a/src/mbgl/renderer/sources/render_tile_source.cpp +++ b/src/mbgl/renderer/sources/render_tile_source.cpp @@ -402,8 +402,8 @@ std::unique_ptr RenderTileSource::createRenderItem() { } void RenderTileSource::prepare(const SourcePrepareParameters& parameters) { - MLN_TRACE_FUNC() - MLN_ZONE_STR(baseImpl->id) + MLN_TRACE_FUNC(); + MLN_ZONE_STR(baseImpl->id); bearing = static_cast(parameters.transform.state.getBearing()); filteredRenderTiles = nullptr; renderTilesSortedByY = nullptr; diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp index 278598793..4f8723ead 100644 --- a/src/mbgl/style/style.cpp +++ b/src/mbgl/style/style.cpp @@ -16,25 +16,25 @@ Style::Style(std::shared_ptr fileSource, float pixelRatio, const Tag Style::~Style() = default; void Style::loadJSON(const std::string& json) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); impl->loadJSON(json); } void Style::loadURL(const std::string& url) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); impl->loadURL(url); } std::string Style::getJSON() const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return impl->getJSON(); } std::string Style::getURL() const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return impl->getURL(); } @@ -44,19 +44,19 @@ std::string Style::getName() const { } CameraOptions Style::getDefaultCamera() const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return impl->getDefaultCamera(); } TransitionOptions Style::getTransitionOptions() const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return impl->getTransitionOptions(); } void Style::setTransitionOptions(const TransitionOptions& options) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); impl->mutated = true; impl->setTransitionOptions(options); @@ -76,7 +76,7 @@ const Light* Style::getLight() const { } std::optional Style::getImage(const std::string& name) const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); auto image = impl->getImage(name); if (!image) return std::nullopt; @@ -84,94 +84,94 @@ std::optional Style::getImage(const std::string& name) const { } void Style::addImage(std::unique_ptr image) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); impl->mutated = true; impl->addImage(std::move(image)); } void Style::removeImage(const std::string& name) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); impl->mutated = true; impl->removeImage(name); } std::vector Style::getSources() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); impl->mutated = true; return impl->getSources(); } std::vector Style::getSources() const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return const_cast(*impl).getSources(); } Source* Style::getSource(const std::string& id) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); impl->mutated = true; return impl->getSource(id); } const Source* Style::getSource(const std::string& id) const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return impl->getSource(id); } void Style::addSource(std::unique_ptr source) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); impl->mutated = true; impl->addSource(std::move(source)); } std::unique_ptr Style::removeSource(const std::string& sourceID) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); impl->mutated = true; return impl->removeSource(sourceID); } std::vector Style::getLayers() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); impl->mutated = true; return impl->getLayers(); } std::vector Style::getLayers() const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return const_cast(*impl).getLayers(); } Layer* Style::getLayer(const std::string& layerID) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); impl->mutated = true; return impl->getLayer(layerID); } const Layer* Style::getLayer(const std::string& layerID) const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return impl->getLayer(layerID); } void Style::addLayer(std::unique_ptr layer, const std::optional& before) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); impl->mutated = true; impl->addLayer(std::move(layer), before); } std::unique_ptr Style::removeLayer(const std::string& id) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); impl->mutated = true; return impl->removeLayer(id); diff --git a/src/mbgl/text/cross_tile_symbol_index.cpp b/src/mbgl/text/cross_tile_symbol_index.cpp index e6ac09270..0faabf27d 100644 --- a/src/mbgl/text/cross_tile_symbol_index.cpp +++ b/src/mbgl/text/cross_tile_symbol_index.cpp @@ -221,8 +221,8 @@ bool CrossTileSymbolLayerIndex::removeStaleBuckets(const std::unordered_set AddLayerResult { - MLN_TRACE_FUNC() - MLN_ZONE_STR(layer.getID()) + MLN_TRACE_FUNC(); + MLN_ZONE_STR(layer.getID()); auto found = layerIndexes.find(layer.getID()); if (found == layerIndexes.end()) { @@ -254,7 +254,7 @@ auto CrossTileSymbolIndex::addLayer(const RenderLayer& layer, float lng) -> AddL } void CrossTileSymbolIndex::pruneUnusedLayers(const std::set& usedLayers) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); for (auto it = layerIndexes.begin(); it != layerIndexes.end();) { if (usedLayers.find(it->first) == usedLayers.end()) { diff --git a/src/mbgl/text/placement.cpp b/src/mbgl/text/placement.cpp index 8b81764ad..d9f33d9bc 100644 --- a/src/mbgl/text/placement.cpp +++ b/src/mbgl/text/placement.cpp @@ -1674,7 +1674,7 @@ bool TilePlacement::shouldRetryPlacement(const JointPlacement& placement, const // static Mutable Placement::create(std::shared_ptr updateParameters_, std::optional> prevPlacement) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); assert(updateParameters_); switch (updateParameters_->mode) { case MapMode::Continuous: diff --git a/src/mbgl/tile/geojson_tile.cpp b/src/mbgl/tile/geojson_tile.cpp index cdb795cf4..803d12651 100644 --- a/src/mbgl/tile/geojson_tile.cpp +++ b/src/mbgl/tile/geojson_tile.cpp @@ -17,7 +17,7 @@ GeoJSONTile::GeoJSONTile(const OverscaledTileID& overscaledTileID, } void GeoJSONTile::updateData(std::shared_ptr data_, bool needsRelayout) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); assert(data_); data = std::move(data_); @@ -33,7 +33,7 @@ void GeoJSONTile::updateData(std::shared_ptr data_, bool nee } void GeoJSONTile::querySourceFeatures(std::vector& result, const SourceQueryOptions& options) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); // Ignore the sourceLayer, there is only one if (auto tileData = getData()) { diff --git a/src/mbgl/tile/geometry_tile.cpp b/src/mbgl/tile/geometry_tile.cpp index 147ec9aae..e1ece707e 100644 --- a/src/mbgl/tile/geometry_tile.cpp +++ b/src/mbgl/tile/geometry_tile.cpp @@ -29,8 +29,8 @@ namespace mbgl { LayerRenderData* GeometryTile::LayoutResult::getLayerRenderData(const style::Layer::Impl& layerImpl) { - MLN_TRACE_FUNC() - MLN_ZONE_STR(layerImpl.id) + MLN_TRACE_FUNC(); + MLN_ZONE_STR(layerImpl.id); auto it = layerRenderData.find(layerImpl.id); if (it == layerRenderData.end()) { @@ -66,7 +66,7 @@ private: using namespace style; std::optional GeometryTileRenderData::getPattern(const std::string& pattern) const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (layoutResult) { const auto& iconAtlas = layoutResult->iconAtlas; @@ -79,7 +79,7 @@ std::optional GeometryTileRenderData::getPattern(const std::strin } void GeometryTileRenderData::upload(gfx::UploadPass& uploadPass) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (!layoutResult) return; @@ -135,7 +135,7 @@ void GeometryTileRenderData::upload(gfx::UploadPass& uploadPass) { } void GeometryTileRenderData::prepare(const SourcePrepareParameters& parameters) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (!layoutResult) return; imagePatches = layoutResult->iconAtlas.getImagePatchesAndUpdateVersions(parameters.imageManager); @@ -188,7 +188,7 @@ GeometryTile::GeometryTile(const OverscaledTileID& id_, std::string sourceID_, c showCollisionBoxes(parameters.debugOptions & MapDebugOptions::Collision) {} GeometryTile::~GeometryTile() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); markObsolete(); @@ -216,7 +216,7 @@ void GeometryTile::setError(std::exception_ptr err) { } void GeometryTile::setData(std::unique_ptr data_) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (obsolete) { return; @@ -232,7 +232,7 @@ void GeometryTile::setData(std::unique_ptr data_) { } void GeometryTile::reset() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); // Mark the tile as pending again if it was complete before to prevent // signaling a complete state despite pending parse operations. @@ -243,13 +243,13 @@ void GeometryTile::reset() { } std::unique_ptr GeometryTile::createRenderData() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return std::make_unique(layoutResult, atlasTextures); } void GeometryTile::setLayers(const std::vector>& layers) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); // Mark the tile as pending again if it was complete before to prevent // signaling a complete state despite pending parse operations. @@ -259,8 +259,8 @@ void GeometryTile::setLayers(const std::vector>& laye impls.reserve(layers.size()); for (const auto& layer : layers) { - MLN_TRACE_ZONE(layer) - MLN_ZONE_STR(layer->baseImpl->id) + MLN_TRACE_ZONE(layer); + MLN_ZONE_STR(layer->baseImpl->id); // Skip irrelevant layers. const auto& layerImpl = *layer->baseImpl; assert(layerImpl.getTypeInfo()->source != LayerTypeInfo::Source::NotRequired); @@ -279,7 +279,7 @@ void GeometryTile::setLayers(const std::vector>& laye } void GeometryTile::setShowCollisionBoxes(const bool showCollisionBoxes_) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (showCollisionBoxes != showCollisionBoxes_) { showCollisionBoxes = showCollisionBoxes_; @@ -289,7 +289,7 @@ void GeometryTile::setShowCollisionBoxes(const bool showCollisionBoxes_) { } void GeometryTile::onLayout(std::shared_ptr result, const uint64_t resultCorrelationID) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); loaded = true; renderable = true; @@ -330,13 +330,13 @@ void GeometryTile::onError(std::exception_ptr err, const uint64_t resultCorrelat } void GeometryTile::onGlyphsAvailable(GlyphMap glyphs) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); worker.self().invoke(&GeometryTileWorker::onGlyphsAvailable, std::move(glyphs)); } void GeometryTile::getGlyphs(GlyphDependencies glyphDependencies) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (fileSource) { glyphManager->getGlyphs(*this, std::move(glyphDependencies), *fileSource); @@ -347,7 +347,7 @@ void GeometryTile::onImagesAvailable(ImageMap images, ImageMap patterns, ImageVersionMap versionMap, uint64_t imageCorrelationID) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); worker.self().invoke(&GeometryTileWorker::onImagesAvailable, std::move(images), @@ -357,7 +357,7 @@ void GeometryTile::onImagesAvailable(ImageMap images, } void GeometryTile::getImages(ImageRequestPair pair) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); imageManager->getImages(*this, std::move(pair)); } @@ -367,7 +367,7 @@ std::shared_ptr GeometryTile::getFeatureIndex() const { } bool GeometryTile::layerPropertiesUpdated(const Immutable& layerProperties) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); LayerRenderData* renderData = getLayerRenderData(*layerProperties->baseImpl); if (!renderData) { @@ -390,13 +390,13 @@ const GeometryTileData* GeometryTile::getData() const { } LayerRenderData* GeometryTile::getLayerRenderData(const style::Layer::Impl& layerImpl) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); return layoutResult ? layoutResult->getLayerRenderData(layerImpl) : nullptr; } float GeometryTile::getQueryPadding(const std::unordered_map& layers) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); float queryPadding = 0; for (const auto& pair : layers) { @@ -415,7 +415,7 @@ void GeometryTile::queryRenderedFeatures(std::unordered_map& result, const SourceQueryOptions& options) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); // Data not yet available, or tile is empty if (!getData()) { @@ -496,7 +496,7 @@ void GeometryTile::performedFadePlacement() { } void GeometryTile::setFeatureState(const LayerFeatureStates& states) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); auto layers = getData(); if ((layers == nullptr) || states.empty() || !layoutResult) { diff --git a/src/mbgl/tile/geometry_tile_data.cpp b/src/mbgl/tile/geometry_tile_data.cpp index 1d8118551..5d83504a0 100644 --- a/src/mbgl/tile/geometry_tile_data.cpp +++ b/src/mbgl/tile/geometry_tile_data.cpp @@ -33,7 +33,7 @@ static double signedArea(const GeometryCoordinates& ring) { } static LinearRing toWagyuPath(const GeometryCoordinates& ring) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); LinearRing result; result.reserve(ring.size()); @@ -44,7 +44,7 @@ static LinearRing toWagyuPath(const GeometryCoordinates& ring) { } static GeometryCollection toGeometryCollection(MultiPolygon&& multipolygon) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); GeometryCollection result; for (auto& polygon : multipolygon) { @@ -56,7 +56,7 @@ static GeometryCollection toGeometryCollection(MultiPolygon&& multipoly } GeometryCollection fixupPolygons(const GeometryCollection& rings) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); using namespace mapbox::geometry::wagyu; @@ -73,7 +73,7 @@ GeometryCollection fixupPolygons(const GeometryCollection& rings) { } std::vector classifyRings(const GeometryCollection& rings) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); std::vector polygons; @@ -111,7 +111,7 @@ std::vector classifyRings(const GeometryCollection& rings) { } void limitHoles(GeometryCollection& polygon, uint32_t maxHoles) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (polygon.size() > 1 + maxHoles) { std::nth_element( @@ -123,7 +123,7 @@ void limitHoles(GeometryCollection& polygon, uint32_t maxHoles) { } Feature::geometry_type convertGeometry(const GeometryTileFeature& geometryTileFeature, const CanonicalTileID& tileID) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); const double size = util::EXTENT * std::pow(2, tileID.z); const double x0 = util::EXTENT * static_cast(tileID.x); @@ -196,7 +196,7 @@ Feature::geometry_type convertGeometry(const GeometryTileFeature& geometryTileFe } GeometryCollection convertGeometry(const Feature::geometry_type& geometryTileFeature, const CanonicalTileID& tileID) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); const double size = util::EXTENT * std::pow(2, tileID.z); const double x0 = util::EXTENT * static_cast(tileID.x); @@ -279,7 +279,7 @@ GeometryCollection convertGeometry(const Feature::geometry_type& geometryTileFea } Feature convertFeature(const GeometryTileFeature& geometryTileFeature, const CanonicalTileID& tileID) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); Feature feature{convertGeometry(geometryTileFeature, tileID)}; feature.properties = geometryTileFeature.getProperties(); diff --git a/src/mbgl/tile/geometry_tile_worker.cpp b/src/mbgl/tile/geometry_tile_worker.cpp index d1a049174..24a81c4ca 100644 --- a/src/mbgl/tile/geometry_tile_worker.cpp +++ b/src/mbgl/tile/geometry_tile_worker.cpp @@ -49,7 +49,7 @@ GeometryTileWorker::GeometryTileWorker(ActorRef self_, showCollisionBoxes(showCollisionBoxes_) {} GeometryTileWorker::~GeometryTileWorker() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); scheduler.runOnRenderThread([renderData_{std::move(renderData)}]() {}); } @@ -128,7 +128,7 @@ GeometryTileWorker::~GeometryTileWorker() { void GeometryTileWorker::setData(std::unique_ptr data_, std::set availableImages_, uint64_t correlationID_) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); try { data = std::move(data_); @@ -155,7 +155,7 @@ void GeometryTileWorker::setData(std::unique_ptr data_, void GeometryTileWorker::setLayers(std::vector> layers_, std::set availableImages_, uint64_t correlationID_) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); try { layers = std::move(layers_); @@ -198,7 +198,7 @@ void GeometryTileWorker::reset(uint64_t correlationID_) { } void GeometryTileWorker::setShowCollisionBoxes(bool showCollisionBoxes_, uint64_t correlationID_) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); try { showCollisionBoxes = showCollisionBoxes_; @@ -228,7 +228,7 @@ void GeometryTileWorker::setShowCollisionBoxes(bool showCollisionBoxes_, uint64_ } void GeometryTileWorker::symbolDependenciesChanged() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); try { switch (state) { @@ -258,7 +258,7 @@ void GeometryTileWorker::symbolDependenciesChanged() { } void GeometryTileWorker::coalesced() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); try { switch (state) { @@ -289,14 +289,14 @@ void GeometryTileWorker::coalesced() { } void GeometryTileWorker::coalesce() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); state = Coalescing; self.invoke(&GeometryTileWorker::coalesced); } void GeometryTileWorker::onGlyphsAvailable(GlyphMap newGlyphMap) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); for (auto& newFontGlyphs : newGlyphMap) { FontStackHash fontStack = newFontGlyphs.first; @@ -327,7 +327,7 @@ void GeometryTileWorker::onImagesAvailable(ImageMap newIconMap, ImageMap newPatternMap, ImageVersionMap newVersionMap, uint64_t imageCorrelationID_) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (imageCorrelationID != imageCorrelationID_) { return; // Ignore outdated image request replies. @@ -340,7 +340,7 @@ void GeometryTileWorker::onImagesAvailable(ImageMap newIconMap, } void GeometryTileWorker::requestNewGlyphs(const GlyphDependencies& glyphDependencies) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); for (auto& fontDependencies : glyphDependencies) { auto fontGlyphs = glyphMap.find(FontStackHasher()(fontDependencies.first)); @@ -356,7 +356,7 @@ void GeometryTileWorker::requestNewGlyphs(const GlyphDependencies& glyphDependen } void GeometryTileWorker::requestNewImages(const ImageDependencies& imageDependencies) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); pendingImageDependencies = imageDependencies; @@ -366,7 +366,7 @@ void GeometryTileWorker::requestNewImages(const ImageDependencies& imageDependen } void GeometryTileWorker::parse() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (!data || !layers) { return; @@ -489,7 +489,7 @@ bool GeometryTileWorker::hasPendingParseResult() const { } void GeometryTileWorker::finalizeLayout() { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (!data || !layers || !hasPendingParseResult() || hasPendingDependencies()) { return; diff --git a/src/mbgl/tile/tile_cache.cpp b/src/mbgl/tile/tile_cache.cpp index 985bee13b..2bbde03a8 100644 --- a/src/mbgl/tile/tile_cache.cpp +++ b/src/mbgl/tile/tile_cache.cpp @@ -6,7 +6,7 @@ namespace mbgl { void TileCache::setSize(size_t size_) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); size = size_; @@ -40,7 +40,7 @@ struct CaptureWrapper { } // namespace void TileCache::deferredRelease(std::unique_ptr&& tile) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); tile->cancel(); @@ -66,7 +66,7 @@ void TileCache::deferredRelease(std::unique_ptr&& tile) { } void TileCache::add(const OverscaledTileID& key, std::unique_ptr&& tile) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (!tile->isRenderable() || !size) { deferredRelease(std::move(tile)); diff --git a/src/mbgl/tile/vector_tile_data.cpp b/src/mbgl/tile/vector_tile_data.cpp index 9139a5cf9..644225a92 100644 --- a/src/mbgl/tile/vector_tile_data.cpp +++ b/src/mbgl/tile/vector_tile_data.cpp @@ -38,7 +38,7 @@ FeatureIdentifier VectorTileFeature::getID() const { } const GeometryCollection& VectorTileFeature::getGeometries() const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (!lines) { const auto scale = static_cast(util::EXTENT) / feature.getExtent(); @@ -81,7 +81,7 @@ std::unique_ptr VectorTileData::clone() const { } std::unique_ptr VectorTileData::getLayer(const std::string& name) const { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (!parsed) { // We're parsing this lazily so that we can construct VectorTileData diff --git a/src/mbgl/util/http_header.cpp b/src/mbgl/util/http_header.cpp index 996fdfd28..cf66fc6c6 100644 --- a/src/mbgl/util/http_header.cpp +++ b/src/mbgl/util/http_header.cpp @@ -21,7 +21,7 @@ namespace mbgl { namespace http { CacheControl CacheControl::parse(const std::string& value) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); namespace qi = boost::spirit::qi; namespace phoenix = boost::phoenix; @@ -43,7 +43,7 @@ std::optional CacheControl::toTimePoint() const { std::optional parseRetryHeaders(const std::optional& retryAfter, const std::optional& xRateLimitReset) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (retryAfter) { try { diff --git a/src/mbgl/util/http_timeout.cpp b/src/mbgl/util/http_timeout.cpp index aad39390b..1eeef972b 100644 --- a/src/mbgl/util/http_timeout.cpp +++ b/src/mbgl/util/http_timeout.cpp @@ -11,7 +11,7 @@ namespace http { Duration errorRetryTimeout(Response::Error::Reason failedRequestReason, uint32_t failedRequests, std::optional retryAfter) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); if (failedRequestReason == Response::Error::Reason::Server) { // Retry after one second three times, then start exponential backoff. diff --git a/src/mbgl/util/io.cpp b/src/mbgl/util/io.cpp index a05c0b348..e66389e33 100644 --- a/src/mbgl/util/io.cpp +++ b/src/mbgl/util/io.cpp @@ -22,7 +22,7 @@ IOException::IOException(int err, const std::string &msg) code(err) {} void write_file(const std::string &filename, const std::string &data) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); FILE *fd = fopen(filename.c_str(), MBGL_FOPEN_MODE_WBE); if (fd) { @@ -34,7 +34,7 @@ void write_file(const std::string &filename, const std::string &data) { } std::string read_file(const std::string &filename) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); std::ifstream file(filename, std::ios::binary); if (file.good()) { @@ -47,7 +47,7 @@ std::string read_file(const std::string &filename) { } std::optional readFile(const std::string &filename) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); std::ifstream file(filename, std::ios::binary); if (file.good()) { @@ -59,7 +59,7 @@ std::optional readFile(const std::string &filename) { } void deleteFile(const std::string &filename) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); const int ret = std::remove(filename.c_str()); if (ret != 0 && errno != ENOENT) { @@ -68,7 +68,7 @@ void deleteFile(const std::string &filename) { } void copyFile(const std::string &destination, const std::string &source) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); std::ifstream src(source, std::ios::binary); if (!src.good()) { diff --git a/src/mbgl/util/thread_pool.cpp b/src/mbgl/util/thread_pool.cpp index a2f70cfd1..bf2ad316d 100644 --- a/src/mbgl/util/thread_pool.cpp +++ b/src/mbgl/util/thread_pool.cpp @@ -110,13 +110,13 @@ void ThreadedSchedulerBase::schedule(std::function&& fn) { } void ThreadedSchedulerBase::schedule(const util::SimpleIdentity tag, std::function&& fn) { - MLN_TRACE_FUNC() + MLN_TRACE_FUNC(); assert(fn); if (!fn) return; std::shared_ptr q; { - MLN_TRACE_ZONE(queue) + MLN_TRACE_ZONE(queue); std::lock_guard lock(taggedQueueLock); // find or insert @@ -127,11 +127,11 @@ void ThreadedSchedulerBase::schedule(const util::SimpleIdentity tag, std::functi } q = result.first->second; - MLN_ZONE_VALUE(taggedQueue.size()) + MLN_ZONE_VALUE(taggedQueue.size()); } { - MLN_TRACE_ZONE(push) + MLN_TRACE_ZONE(push); std::lock_guard lock(q->lock); q->queue.push(std::move(fn)); taskCount++;