diagnostics: add STEP-099 render source readiness audit

This commit is contained in:
tei
2026-10-06 15:15:12 +09:00
parent e8b451fe70
commit 8a5214d92d
13 changed files with 915 additions and 9 deletions

View File

@@ -11,8 +11,10 @@
#include <mbgl/style/source_impl.hpp>
#include <mbgl/style/layer_properties.hpp>
#include <cstdint>
#include <map>
#include <memory>
#include <optional>
#include <unordered_map>
#include <vector>
@@ -49,6 +51,14 @@ public:
using RenderTiles = std::shared_ptr<const std::vector<std::reference_wrapper<const RenderTile>>>;
struct RenderSourceReadinessStats {
bool tileBacked = false;
std::optional<uint32_t> tileCount;
std::optional<uint32_t> incompleteTileCount;
std::optional<uint32_t> loadedTileCount;
bool hasFadingTiles = false;
};
class RenderSource : protected TileObserver {
public:
static std::unique_ptr<RenderSource> create(const Immutable<style::Source::Impl>&, const TaggedScheduler&);
@@ -68,6 +78,17 @@ public:
virtual void prepare(const SourcePrepareParameters&) = 0;
virtual void updateFadingTiles() = 0;
virtual bool hasFadingTiles() const = 0;
// Read on the renderer thread while the source and its tile pyramid are owned by RenderOrchestrator.
// This is an observational summary and must not define or modify isLoaded().
virtual RenderSourceReadinessStats getReadinessDiagnostics() const {
return {
.tileBacked = false,
.tileCount = std::nullopt,
.incompleteTileCount = std::nullopt,
.loadedTileCount = std::nullopt,
.hasFadingTiles = hasFadingTiles(),
};
}
// If supported, returns a shared list of RenderTiles, sorted by tile id and
// excluding tiles hold for fade; returns nullptr otherwise.
virtual RenderTiles getRenderTiles() const { return nullptr; }