Add semicolon after Tracy preprocessor macros (#2753)

Co-authored-by: Bart Louwers <bart.louwers@gmail.com>
This commit is contained in:
Alex Cristici
2024-08-27 14:02:13 +03:00
committed by GitHub
parent dd104ded89
commit 6a7bf2f7fb
38 changed files with 336 additions and 329 deletions

View File

@@ -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

View File

@@ -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();
}

View File

@@ -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();
@@ -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);
}

View File

@@ -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<HeadlessRenderableResource>(*this, static_cast<gl::Context&>(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<gl::Context&>(getContext()).finish();
}
@@ -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);
}
@@ -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);
}

View File

@@ -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<GLFWGLRenderableResource>(*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<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);
}

View File

@@ -33,7 +33,7 @@ const mbgl::TaggedScheduler& GLFWRendererFrontend::getThreadPool() const {
}
void GLFWRendererFrontend::render() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
assert(renderer);

View File

@@ -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<SnapshotObserver>()),
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<GLFWView *>(glfwGetWindowUserPointer(window));
@@ -613,7 +613,7 @@ struct Interpolator<mbgl::LatLng> {
} // 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<mbgl::style::Image> GLFWView::makeImage(const std::string &id,
int width,
int height,
float pixelRatio) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
const int r = static_cast<int>(255 * (static_cast<double>(std::rand()) / RAND_MAX));
const int g = static_cast<int>(255 * (static_cast<double>(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<double> 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<double> 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<mbgl::MapSnapshotter>(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<GLFWView *>(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<GLFWView *>(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<GLFWView *>(glfwGetWindowUserPointer(window));
view->backend->setSize({static_cast<uint32_t>(width), static_cast<uint32_t>(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<GLFWView *>(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<GLFWView *>(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<GLFWView *>(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<void()> 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<mbgl::style::LocationIndicatorLayer *>(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<mbgl::style::LocationIndicatorLayer *>(map->getStyle().getLayer("puck"));

View File

@@ -73,7 +73,7 @@ bool Mailbox::isOpen() const {
}
void Mailbox::push(std::unique_ptr<Message> 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> message) {
}
}};
MLN_TRACE_ZONE(push lock)
std::lock_guard<std::mutex> pushingLock(pushingMutex);
if (closed) {
state = State::Abandoned;
return;
}
bool wasEmpty = false;
{
MLN_TRACE_ZONE(queue lock)
std::lock_guard<std::mutex> queueLock(queueMutex);
wasEmpty = queue.empty();
queue.push(std::move(message));
}
MLN_TRACE_ZONE(push_lock);
std::lock_guard<std::mutex> 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<std::mutex> queueLock(queueMutex);
wasEmpty = queue.empty();
queue.push(std::move(message));
}
if (wasEmpty) {
MLN_TRACE_ZONE(schedule);
scheduleToRecieve(schedulerTag);
}
}
}

View File

@@ -26,7 +26,7 @@ void RenderAnnotationSource::update(Immutable<style::Source::Impl> baseImpl_,
const bool needsRendering,
const bool needsRelayout,
const TileParameters& parameters) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
std::swap(baseImpl, baseImpl_);

View File

@@ -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<gl::Fence>& fence) override {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
if (buffers.size() == 0) {
return;
}

View File

@@ -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<gl::ProcAddress(const char*)>& getProcAddress) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
if (const auto* extensions = reinterpret_cast<const char*>(MBGL_CHECK_ERROR(glGetString(GL_EXTENSIONS)))) {
auto fn = [&](std::initializer_list<std::pair<const char*, const char*>> probes) -> ProcAddress {
@@ -175,7 +175,7 @@ void Context::initializeExtensions(const std::function<gl::ProcAddress(const cha
extension::loadTimeStampQueryExtension(fn);
#endif
}
MLN_TRACE_GL_CONTEXT()
MLN_TRACE_GL_CONTEXT();
}
void Context::enableDebugging() {
@@ -239,14 +239,14 @@ UniqueProgram Context::createProgram(ShaderID vertexShader, ShaderID fragmentSha
}
void Context::linkProgram(ProgramID program_) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
MBGL_CHECK_ERROR(glLinkProgram(program_));
verifyProgramLinkage(program_);
}
void Context::verifyProgramLinkage(ProgramID program_) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
GLint status;
MBGL_CHECK_ERROR(glGetProgramiv(program_, GL_LINK_STATUS, &status));
@@ -266,7 +266,7 @@ void Context::verifyProgramLinkage(ProgramID program_) {
}
UniqueTexture Context::createUniqueTexture() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
if (pooledTextures.empty()) {
pooledTextures.resize(TextureMax);
@@ -282,7 +282,7 @@ UniqueTexture Context::createUniqueTexture() {
}
VertexArray Context::createVertexArray() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
VertexArrayID id = 0;
MBGL_CHECK_ERROR(glGenVertexArrays(1, &id));
@@ -292,7 +292,7 @@ VertexArray Context::createVertexArray() {
}
UniqueFramebuffer Context::createFramebuffer() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
FramebufferID id = 0;
MBGL_CHECK_ERROR(glGenFramebuffers(1, &id));
@@ -304,7 +304,7 @@ UniqueFramebuffer Context::createFramebuffer() {
std::unique_ptr<gfx::TextureResource> 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<gfx::TextureResource> Context::createTextureResource(const Size
std::unique_ptr<gfx::RenderbufferResource> 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<gfx::RenderbufferResource> Context::createRenderbufferResource(c
std::unique_ptr<uint8_t[]> 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<uint8_t[]>(stride * size.height);
@@ -388,7 +388,7 @@ std::unique_ptr<uint8_t[]> 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<gfx::RenderbufferPixelType::DepthStencil>& depthStencil) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC_GL()
MLN_TRACE_FUNC();
MLN_TRACE_FUNC_GL();
auto& depthStencilResource = depthStencil.getResource<gl::RenderbufferResource>();
#ifdef GL_DEPTH_STENCIL_ATTACHMENT
@@ -441,7 +441,7 @@ void bindDepthStencilRenderbuffer(const gfx::Renderbuffer<gfx::RenderbufferPixel
Framebuffer Context::createFramebuffer(
const gfx::Renderbuffer<gfx::RenderbufferPixelType::RGBA>& color,
const gfx::Renderbuffer<gfx::RenderbufferPixelType::DepthStencil>& 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<gfx::RenderbufferPixelType::RGBA>& color) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
auto fbo = createFramebuffer();
bindFramebuffer = fbo;
@@ -471,7 +471,7 @@ Framebuffer Context::createFramebuffer(const gfx::Renderbuffer<gfx::Renderbuffer
Framebuffer Context::createFramebuffer(
const gfx::Texture& color, const gfx::Renderbuffer<gfx::RenderbufferPixelType::DepthStencil>& 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<gfx::RenderbufferPixelType::Depth>& 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<gfx::OffscreenTexture> Context::createOffscreenTexture(const Size size,
const gfx::TextureChannelDataType type) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
return std::make_unique<gl::OffscreenTexture>(*this, size, type);
}
std::unique_ptr<gfx::DrawScopeResource> Context::createDrawScopeResource() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
return std::make_unique<gl::DrawScopeResource>(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<gl::DrawableGLBuilder>(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<gl::UniformBufferGL>(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<TileLayerGroupGL>(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<LayerGroupGL>(layerIndex, initialCapacity, std::move(name));
}
gfx::Texture2DPtr Context::createTexture2D() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
return std::make_shared<gl::Texture2D>(*this);
}
RenderTargetPtr Context::createRenderTarget(const Size size, const gfx::TextureChannelDataType type) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
return std::make_shared<RenderTarget>(*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<mbgl::Color> color, std::optional<float> depth, std::optional<int32_t> 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<gfx::CommandEncoder> Context::createCommandEncoder() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
backend.updateAssumedState();
if (backend.contextIsShared()) {
@@ -798,8 +798,8 @@ std::unique_ptr<gfx::CommandEncoder> 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<gl::Fence> 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));

View File

@@ -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;

View File

@@ -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);

View File

@@ -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<gl::Context&>(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;

View File

@@ -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

View File

@@ -23,7 +23,7 @@ RendererBackend::RendererBackend(const gfx::ContextMode contextMode_, const Tagg
: gfx::RendererBackend(contextMode_, threadPool_) {}
std::unique_ptr<gfx::Context> RendererBackend::createContext() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
auto result = std::make_unique<gl::Context>(
*this); // Tagged background thread pool will be owned by the RendererBackend
@@ -33,13 +33,13 @@ std::unique_ptr<gfx::Context> RendererBackend::createContext() {
}
PremultipliedImage RendererBackend::readFramebuffer(const Size& size) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
return getContext<gl::Context>().readFramebuffer<PremultipliedImage>(size);
}
void RendererBackend::assumeFramebufferBinding(const gl::FramebufferID fbo) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
getContext<gl::Context>().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<gl::Context>().viewport.setCurrentValue({x, y, size});
assert(gl::value::Viewport::Get() == getContext<gl::Context>().viewport.getCurrentValue());
}
void RendererBackend::assumeScissorTest(bool enabled) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
getContext<gl::Context>().scissorTest.setCurrentValue(enabled);
assert(gl::value::ScissorTest::Get() == getContext<gl::Context>().scissorTest.getCurrentValue());
}
bool RendererBackend::implicitFramebufferBound() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
return getContext<gl::Context>().bindFramebuffer.getCurrentValue() == ImplicitFramebufferBinding;
}
void RendererBackend::setFramebufferBinding(const gl::FramebufferID fbo) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
getContext<gl::Context>().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<gl::Context>().viewport = {x, y, size};
assert(gl::value::Viewport::Get() == getContext<gl::Context>().viewport.getCurrentValue());
}
void RendererBackend::setScissorTest(bool enabled) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
getContext<gl::Context>().scissorTest = enabled;
assert(gl::value::ScissorTest::Get() == getContext<gl::Context>().scissorTest.getCurrentValue());
@@ -99,7 +99,7 @@ RendererBackend::~RendererBackend() = default;
/// @param programParameters ProgramParameters used to initialize each instance
template <shaders::BuiltIn... ShaderID>
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();
registerTypes<shaders::BuiltIn::BackgroundShader,
shaders::BuiltIn::BackgroundPatternShader,

View File

@@ -34,11 +34,13 @@ static int channelStorageSize(gfx::TextureChannelDataType type) {
TextureResource::TextureResource(UniqueTexture&& texture_, int byteSize_)
: texture(std::move(texture_)),
byteSize(byteSize_){MLN_TRACE_ALLOC_TEXTURE(texture.get(), byteSize)}
byteSize(byteSize_) {
MLN_TRACE_ALLOC_TEXTURE(texture.get(), byteSize);
}
TextureResource::~TextureResource() noexcept {
TextureResource::~TextureResource() noexcept {
auto& stats = texture.get_deleter().context->renderingStats();
MLN_TRACE_FREE_TEXTURE(texture.get())
MLN_TRACE_FREE_TEXTURE(texture.get());
stats.memTextures -= byteSize;
assert(stats.memTextures >= 0);
}

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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)) {

View File

@@ -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<std::string> ImageManager::getAvailableImages() const {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
std::lock_guard<std::recursive_mutex> readWriteLock(rwLock);
MLN_TRACE_ZONE(copy)
return availableImages;
{
MLN_TRACE_ZONE(copy);
return availableImages;
}
}
void ImageManager::clear() {

View File

@@ -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<RenderTree> RenderOrchestrator::createRenderTree(
const std::shared_ptr<UpdateParameters>& updateParameters) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
const auto startTime = util::MonotonicTimer::now().count();
@@ -371,8 +371,8 @@ std::unique_ptr<RenderTree> 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<RenderTree> 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<RenderTree> RenderOrchestrator::createRenderTree(
std::vector<Feature> RenderOrchestrator::queryRenderedFeatures(const ScreenLineString& geometry,
const RenderedQueryOptions& options) const {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
std::unordered_map<std::string, const RenderLayer*> layers;
if (options.layerIDs) {
@@ -587,7 +587,7 @@ void RenderOrchestrator::queryRenderedSymbols(std::unordered_map<std::string, st
const ScreenLineString& geometry,
const std::unordered_map<std::string, const RenderLayer*>& 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<Feature> RenderOrchestrator::queryRenderedFeatures(
const ScreenLineString& geometry,
const RenderedQueryOptions& options,
const std::unordered_map<std::string, const RenderLayer*>& layers) const {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
std::unordered_set<std::string> sourceIDs;
std::unordered_map<std::string, const RenderLayer*> filteredLayers;
@@ -688,7 +688,7 @@ std::vector<Feature> RenderOrchestrator::queryRenderedFeatures(
}
std::vector<Feature> RenderOrchestrator::queryShapeAnnotations(const ScreenLineString& geometry) const {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
assert(LayerManager::annotationsEnabled);
std::unordered_map<std::string, const RenderLayer*> shapeAnnotationLayers;
@@ -710,7 +710,7 @@ std::vector<Feature> RenderOrchestrator::queryShapeAnnotations(const ScreenLineS
std::vector<Feature> 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<std::map<std::string, Value>>& 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<std::string>& 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<std::string>& 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<std::string>& sourceLayerID,
const std::optional<std::string>& featureID,
const std::optional<std::string>& 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<std::vector<Immutable<style::Source::Impl>>>();
if (!layerImpls->empty()) layerImpls = makeMutable<std::vector<Immutable<style::Layer::Impl>>>();
@@ -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>& 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<void()>& done) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
observer->onStyleImageMissing(id, done);
}
void RenderOrchestrator::onRemoveUnusedStyleImages(const std::vector<std::string>& unusedImageIDs) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
observer->onRemoveUnusedStyleImages(unusedImageIDs);
}

View File

@@ -30,7 +30,7 @@ void Renderer::setObserver(RendererObserver* observer) {
}
void Renderer::render(const std::shared_ptr<UpdateParameters>& updateParameters) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
assert(updateParameters);
if (auto renderTree = impl->orchestrator.createRenderTree(updateParameters)) {
renderTree->prepare();

View File

@@ -74,7 +74,7 @@ void Renderer::Impl::setObserver(RendererObserver* observer_) {
void Renderer::Impl::render(const RenderTree& renderTree,
[[maybe_unused]] const std::shared_ptr<UpdateParameters>& 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() {

View File

@@ -402,8 +402,8 @@ std::unique_ptr<RenderItem> 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<float>(parameters.transform.state.getBearing());
filteredRenderTiles = nullptr;
renderTilesSortedByY = nullptr;

View File

@@ -16,25 +16,25 @@ Style::Style(std::shared_ptr<FileSource> 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<Image> 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<Image> Style::getImage(const std::string& name) const {
}
void Style::addImage(std::unique_ptr<Image> 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<Source*> Style::getSources() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
impl->mutated = true;
return impl->getSources();
}
std::vector<const Source*> Style::getSources() const {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
return const_cast<const Impl&>(*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> source) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
impl->mutated = true;
impl->addSource(std::move(source));
}
std::unique_ptr<Source> Style::removeSource(const std::string& sourceID) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
impl->mutated = true;
return impl->removeSource(sourceID);
}
std::vector<Layer*> Style::getLayers() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
impl->mutated = true;
return impl->getLayers();
}
std::vector<const Layer*> Style::getLayers() const {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
return const_cast<const Impl&>(*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> layer, const std::optional<std::string>& before) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
impl->mutated = true;
impl->addLayer(std::move(layer), before);
}
std::unique_ptr<Layer> Style::removeLayer(const std::string& id) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
impl->mutated = true;
return impl->removeLayer(id);

View File

@@ -221,8 +221,8 @@ bool CrossTileSymbolLayerIndex::removeStaleBuckets(const std::unordered_set<uint
CrossTileSymbolIndex::CrossTileSymbolIndex() = default;
auto CrossTileSymbolIndex::addLayer(const RenderLayer& layer, float lng) -> 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<std::string>& usedLayers) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
for (auto it = layerIndexes.begin(); it != layerIndexes.end();) {
if (usedLayers.find(it->first) == usedLayers.end()) {

View File

@@ -1674,7 +1674,7 @@ bool TilePlacement::shouldRetryPlacement(const JointPlacement& placement, const
// static
Mutable<Placement> Placement::create(std::shared_ptr<const UpdateParameters> updateParameters_,
std::optional<Immutable<Placement>> prevPlacement) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
assert(updateParameters_);
switch (updateParameters_->mode) {
case MapMode::Continuous:

View File

@@ -17,7 +17,7 @@ GeoJSONTile::GeoJSONTile(const OverscaledTileID& overscaledTileID,
}
void GeoJSONTile::updateData(std::shared_ptr<style::GeoJSONData> 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<style::GeoJSONData> data_, bool nee
}
void GeoJSONTile::querySourceFeatures(std::vector<Feature>& result, const SourceQueryOptions& options) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
// Ignore the sourceLayer, there is only one
if (auto tileData = getData()) {

View File

@@ -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<ImagePosition> 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<ImagePosition> 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<const GeometryTileData> data_) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
if (obsolete) {
return;
@@ -232,7 +232,7 @@ void GeometryTile::setData(std::unique_ptr<const GeometryTileData> 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<TileRenderData> GeometryTile::createRenderData() {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
return std::make_unique<GeometryTileRenderData>(layoutResult, atlasTextures);
}
void GeometryTile::setLayers(const std::vector<Immutable<LayerProperties>>& 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<Immutable<LayerProperties>>& 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<Immutable<LayerProperties>>& 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<LayoutResult> 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<FeatureIndex> GeometryTile::getFeatureIndex() const {
}
bool GeometryTile::layerPropertiesUpdated(const Immutable<style::LayerProperties>& 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<std::string, const RenderLayer*>& 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<std::string, std::ve
const RenderedQueryOptions& options,
const mat4& projMatrix,
const SourceFeatureState& featureState) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
if (!getData()) return;
@@ -439,7 +439,7 @@ void GeometryTile::queryRenderedFeatures(std::unordered_map<std::string, std::ve
}
void GeometryTile::querySourceFeatures(std::vector<Feature>& 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) {

View File

@@ -33,7 +33,7 @@ static double signedArea(const GeometryCoordinates& ring) {
}
static LinearRing<int32_t> toWagyuPath(const GeometryCoordinates& ring) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
LinearRing<int32_t> result;
result.reserve(ring.size());
@@ -44,7 +44,7 @@ static LinearRing<int32_t> toWagyuPath(const GeometryCoordinates& ring) {
}
static GeometryCollection toGeometryCollection(MultiPolygon<int16_t>&& multipolygon) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
GeometryCollection result;
for (auto& polygon : multipolygon) {
@@ -56,7 +56,7 @@ static GeometryCollection toGeometryCollection(MultiPolygon<int16_t>&& 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<GeometryCollection> classifyRings(const GeometryCollection& rings) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
std::vector<GeometryCollection> polygons;
@@ -111,7 +111,7 @@ std::vector<GeometryCollection> 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<double>(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<double>(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();

View File

@@ -49,7 +49,7 @@ GeometryTileWorker::GeometryTileWorker(ActorRef<GeometryTileWorker> 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<const GeometryTileData> data_,
std::set<std::string> 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<const GeometryTileData> data_,
void GeometryTileWorker::setLayers(std::vector<Immutable<LayerProperties>> layers_,
std::set<std::string> 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;

View File

@@ -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>&& tile) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
tile->cancel();
@@ -66,7 +66,7 @@ void TileCache::deferredRelease(std::unique_ptr<Tile>&& tile) {
}
void TileCache::add(const OverscaledTileID& key, std::unique_ptr<Tile>&& tile) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
if (!tile->isRenderable() || !size) {
deferredRelease(std::move(tile));

View File

@@ -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<float>(util::EXTENT) / feature.getExtent();
@@ -81,7 +81,7 @@ std::unique_ptr<GeometryTileData> VectorTileData::clone() const {
}
std::unique_ptr<GeometryTileLayer> 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

View File

@@ -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<Timestamp> CacheControl::toTimePoint() const {
std::optional<Timestamp> parseRetryHeaders(const std::optional<std::string>& retryAfter,
const std::optional<std::string>& xRateLimitReset) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
if (retryAfter) {
try {

View File

@@ -11,7 +11,7 @@ namespace http {
Duration errorRetryTimeout(Response::Error::Reason failedRequestReason,
uint32_t failedRequests,
std::optional<Timestamp> retryAfter) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
if (failedRequestReason == Response::Error::Reason::Server) {
// Retry after one second three times, then start exponential backoff.

View File

@@ -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<std::string> 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<std::string> 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()) {

View File

@@ -110,13 +110,13 @@ void ThreadedSchedulerBase::schedule(std::function<void()>&& fn) {
}
void ThreadedSchedulerBase::schedule(const util::SimpleIdentity tag, std::function<void()>&& fn) {
MLN_TRACE_FUNC()
MLN_TRACE_FUNC();
assert(fn);
if (!fn) return;
std::shared_ptr<Queue> q;
{
MLN_TRACE_ZONE(queue)
MLN_TRACE_ZONE(queue);
std::lock_guard<std::mutex> 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<std::mutex> lock(q->lock);
q->queue.push(std::move(fn));
taskCount++;