Skip to content

Commit

Permalink
Add source name to debug tile labels
Browse files Browse the repository at this point in the history
  • Loading branch information
TimSylvester committed Feb 26, 2025
1 parent c57350a commit 8755223
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
9 changes: 6 additions & 3 deletions src/mbgl/renderer/buckets/debug_bucket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ DebugBucket::DebugBucket(const OverscaledTileID& id,
const bool complete_,
std::optional<Timestamp> modified_,
std::optional<Timestamp> expires_,
MapDebugOptions debugMode_)
MapDebugOptions debugMode_,
std::string sourceName_)
: renderable(renderable_),
complete(complete_),
modified(std::move(modified_)),
expires(std::move(expires_)),
debugMode(debugMode_) {
debugMode(debugMode_),
sourceName(std::move(sourceName_)) {
auto addText = [&](const std::string& text, double left, double baseline, double scale) {
for (uint8_t c : text) {
if (c < 32 || c >= 127) continue;
Expand Down Expand Up @@ -54,7 +56,8 @@ DebugBucket::DebugBucket(const OverscaledTileID& id,
const std::string text = util::toString(id) + " - " +
(complete ? "complete"
: renderable ? "renderable"
: "pending");
: "pending") +
" " + sourceName;
addText(text, 50, baseline, 5);
baseline += 200;
}
Expand Down
4 changes: 3 additions & 1 deletion src/mbgl/renderer/buckets/debug_bucket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class DebugBucket : private util::noncopyable {
bool complete,
std::optional<Timestamp> modified,
std::optional<Timestamp> expires,
MapDebugOptions);
MapDebugOptions,
std::string sourceName);

void upload(gfx::UploadPass&);

Expand All @@ -29,6 +30,7 @@ class DebugBucket : private util::noncopyable {
const std::optional<Timestamp> modified;
const std::optional<Timestamp> expires;
const MapDebugOptions debugMode;
const std::string sourceName;

gfx::VertexVector<FillLayoutVertex> vertices;
gfx::IndexVector<gfx::Lines> indices;
Expand Down
8 changes: 4 additions & 4 deletions src/mbgl/renderer/render_orchestrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,11 @@ std::unique_ptr<RenderTree> RenderOrchestrator::createRenderTree(
}

// Prepare. Update all matrices and generate data that we should upload to the GPU.
for (const auto& entry : renderSources) {
for (const auto& [name, renderSource] : renderSources) {
MLN_TRACE_ZONE(prepare source);
if (entry.second->isEnabled()) {
entry.second->prepare(
{renderTreeParameters->transformParams, updateParameters->debugOptions, *imageManager});
if (renderSource->isEnabled()) {
renderSource->prepare(
{renderTreeParameters->transformParams, updateParameters->debugOptions, *imageManager, name});
}
}

Expand Down
1 change: 1 addition & 0 deletions src/mbgl/renderer/render_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class SourcePrepareParameters {
const TransformParameters& transform;
const MapDebugOptions& debugOptions;
const ImageManager& imageManager;
const std::string sourceName;
};

using RenderTiles = std::shared_ptr<const std::vector<std::reference_wrapper<const RenderTile>>>;
Expand Down
9 changes: 7 additions & 2 deletions src/mbgl/renderer/render_tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,13 @@ void RenderTile::prepare(const SourcePrepareParameters& parameters) {
(!debugBucket || debugBucket->renderable != tile.isRenderable() || debugBucket->complete != tile.isComplete() ||
!(debugBucket->modified == tile.modified) || !(debugBucket->expires == tile.expires) ||
debugBucket->debugMode != parameters.debugOptions)) {
debugBucket = std::make_unique<DebugBucket>(
tile.id, tile.isRenderable(), tile.isComplete(), tile.modified, tile.expires, parameters.debugOptions);
debugBucket = std::make_unique<DebugBucket>(tile.id,
tile.isRenderable(),
tile.isComplete(),
tile.modified,
tile.expires,
parameters.debugOptions,
parameters.sourceName);
} else if (parameters.debugOptions == MapDebugOptions::NoDebug) {
debugBucket.reset();
}
Expand Down

0 comments on commit 8755223

Please sign in to comment.