From 9224a156b89bb627678805de7e467ade411d3bf6 Mon Sep 17 00:00:00 2001 From: Alex Cristici Date: Wed, 31 Jul 2024 19:30:07 +0300 Subject: [PATCH 01/19] Reuse rendered tiles to avoid empty screen. --- src/mbgl/algorithm/update_renderables.hpp | 19 +++++++++++++++++++ src/mbgl/renderer/tile_pyramid.cpp | 3 ++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/mbgl/algorithm/update_renderables.hpp b/src/mbgl/algorithm/update_renderables.hpp index dd46bcd13e9..1371a41fb78 100644 --- a/src/mbgl/algorithm/update_renderables.hpp +++ b/src/mbgl/algorithm/update_renderables.hpp @@ -20,6 +20,7 @@ void updateRenderables(GetTileFn getTile, RetainTileFn retainTile, RenderTileFn renderTile, const IdealTileIDs& idealTileIDs, + const std::map> previouslyRenderedTiles, const Range& zoomRange, const std::optional& maxParentOverscaleFactor = std::nullopt) { std::unordered_set checked; @@ -54,6 +55,18 @@ void updateRenderables(GetTileFn getTile, // The tile isn't loaded yet, but retain it anyway because it's an ideal tile. retainTile(*tile, TileNecessity::Required); + + auto addPreviouslyRenderedTilesIfChildOf = [&](const UnwrappedTileID& tileID) { + for (auto previouslyRenderedTileIt : previouslyRenderedTiles) { + const UnwrappedTileID previouslyRenderedTileID = previouslyRenderedTileIt.first; + Tile& previouslyRenderedTile = previouslyRenderedTileIt.second; + if (previouslyRenderedTileID == tileID || previouslyRenderedTileID.isChildOf(tileID)) { + retainTile(previouslyRenderedTile, TileNecessity::Optional); + renderTile(previouslyRenderedTileID, previouslyRenderedTile); + } + } + }; + covered = true; overscaledZ = idealDataTileID.overscaledZ + 1; if (overscaledZ > zoomRange.max) { @@ -65,6 +78,9 @@ void updateRenderables(GetTileFn getTile, renderTile(idealRenderTileID, *tile); } else { covered = false; + + // Reuse previously rendered tiles in order to avoid empty screen + addPreviouslyRenderedTilesIfChildOf(idealRenderTileID); } } else { // Check all four actual child tiles. @@ -78,6 +94,9 @@ void updateRenderables(GetTileFn getTile, // At least one child tile doesn't exist, so we are // going to look for parents as well. covered = false; + + // Reuse previously rendered tiles in order to avoid empty screen + addPreviouslyRenderedTilesIfChildOf(childDataTileID.toUnwrapped()); } } } diff --git a/src/mbgl/renderer/tile_pyramid.cpp b/src/mbgl/renderer/tile_pyramid.cpp index f3f6e50917d..2804078fc0f 100644 --- a/src/mbgl/renderer/tile_pyramid.cpp +++ b/src/mbgl/renderer/tile_pyramid.cpp @@ -197,12 +197,13 @@ void TilePyramid::update(const std::vector>& l retainTileFn, [](const UnwrappedTileID&, Tile&) {}, panTiles, + previouslyRenderedTiles, zoomRange, maxParentTileOverscaleFactor); } algorithm::updateRenderables( - getTileFn, createTileFn, retainTileFn, renderTileFn, idealTiles, zoomRange, maxParentTileOverscaleFactor); + getTileFn, createTileFn, retainTileFn, renderTileFn, idealTiles, previouslyRenderedTiles, zoomRange, maxParentTileOverscaleFactor); for (auto previouslyRenderedTile : previouslyRenderedTiles) { Tile& tile = previouslyRenderedTile.second; From 4bc2c2338d084b965fa6a54a5d9d912375de5f4a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 31 Jul 2024 16:35:55 +0000 Subject: [PATCH 02/19] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/mbgl/algorithm/update_renderables.hpp | 8 ++++---- src/mbgl/renderer/tile_pyramid.cpp | 10 ++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/mbgl/algorithm/update_renderables.hpp b/src/mbgl/algorithm/update_renderables.hpp index 1371a41fb78..0b92390d664 100644 --- a/src/mbgl/algorithm/update_renderables.hpp +++ b/src/mbgl/algorithm/update_renderables.hpp @@ -55,7 +55,7 @@ void updateRenderables(GetTileFn getTile, // The tile isn't loaded yet, but retain it anyway because it's an ideal tile. retainTile(*tile, TileNecessity::Required); - + auto addPreviouslyRenderedTilesIfChildOf = [&](const UnwrappedTileID& tileID) { for (auto previouslyRenderedTileIt : previouslyRenderedTiles) { const UnwrappedTileID previouslyRenderedTileID = previouslyRenderedTileIt.first; @@ -66,7 +66,7 @@ void updateRenderables(GetTileFn getTile, } } }; - + covered = true; overscaledZ = idealDataTileID.overscaledZ + 1; if (overscaledZ > zoomRange.max) { @@ -78,7 +78,7 @@ void updateRenderables(GetTileFn getTile, renderTile(idealRenderTileID, *tile); } else { covered = false; - + // Reuse previously rendered tiles in order to avoid empty screen addPreviouslyRenderedTilesIfChildOf(idealRenderTileID); } @@ -94,7 +94,7 @@ void updateRenderables(GetTileFn getTile, // At least one child tile doesn't exist, so we are // going to look for parents as well. covered = false; - + // Reuse previously rendered tiles in order to avoid empty screen addPreviouslyRenderedTilesIfChildOf(childDataTileID.toUnwrapped()); } diff --git a/src/mbgl/renderer/tile_pyramid.cpp b/src/mbgl/renderer/tile_pyramid.cpp index 2804078fc0f..2cd89ab9b1a 100644 --- a/src/mbgl/renderer/tile_pyramid.cpp +++ b/src/mbgl/renderer/tile_pyramid.cpp @@ -202,8 +202,14 @@ void TilePyramid::update(const std::vector>& l maxParentTileOverscaleFactor); } - algorithm::updateRenderables( - getTileFn, createTileFn, retainTileFn, renderTileFn, idealTiles, previouslyRenderedTiles, zoomRange, maxParentTileOverscaleFactor); + algorithm::updateRenderables(getTileFn, + createTileFn, + retainTileFn, + renderTileFn, + idealTiles, + previouslyRenderedTiles, + zoomRange, + maxParentTileOverscaleFactor); for (auto previouslyRenderedTile : previouslyRenderedTiles) { Tile& tile = previouslyRenderedTile.second; From 88f35a50301e803fbb19b88a60b05b239383f353 Mon Sep 17 00:00:00 2001 From: Alex Cristici Date: Wed, 31 Jul 2024 20:49:47 +0300 Subject: [PATCH 03/19] Typo. --- src/mbgl/algorithm/update_renderables.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mbgl/algorithm/update_renderables.hpp b/src/mbgl/algorithm/update_renderables.hpp index 0b92390d664..1c57609c19a 100644 --- a/src/mbgl/algorithm/update_renderables.hpp +++ b/src/mbgl/algorithm/update_renderables.hpp @@ -56,7 +56,7 @@ void updateRenderables(GetTileFn getTile, // The tile isn't loaded yet, but retain it anyway because it's an ideal tile. retainTile(*tile, TileNecessity::Required); - auto addPreviouslyRenderedTilesIfChildOf = [&](const UnwrappedTileID& tileID) { + auto addPreviouslyRenderedTilesIfChildrenOf = [&](const UnwrappedTileID& tileID) { for (auto previouslyRenderedTileIt : previouslyRenderedTiles) { const UnwrappedTileID previouslyRenderedTileID = previouslyRenderedTileIt.first; Tile& previouslyRenderedTile = previouslyRenderedTileIt.second; @@ -80,7 +80,7 @@ void updateRenderables(GetTileFn getTile, covered = false; // Reuse previously rendered tiles in order to avoid empty screen - addPreviouslyRenderedTilesIfChildOf(idealRenderTileID); + addPreviouslyRenderedTilesIfChildrenOf(idealRenderTileID); } } else { // Check all four actual child tiles. @@ -96,7 +96,7 @@ void updateRenderables(GetTileFn getTile, covered = false; // Reuse previously rendered tiles in order to avoid empty screen - addPreviouslyRenderedTilesIfChildOf(childDataTileID.toUnwrapped()); + addPreviouslyRenderedTilesIfChildrenOf(childDataTileID.toUnwrapped()); } } } From b145ec83cf69e29a1e96cc2a77a7a81c7bd90d4c Mon Sep 17 00:00:00 2001 From: Alex Cristici Date: Wed, 31 Jul 2024 21:02:38 +0300 Subject: [PATCH 04/19] Fixed update renderables test. --- test/algorithm/update_renderables.test.cpp | 96 +++++++++++----------- test/src/mbgl/test/mock.hpp | 1 + 2 files changed, 49 insertions(+), 48 deletions(-) diff --git a/test/algorithm/update_renderables.test.cpp b/test/algorithm/update_renderables.test.cpp index ff0705b3da6..d1e6884f0a2 100644 --- a/test/algorithm/update_renderables.test.cpp +++ b/test/algorithm/update_renderables.test.cpp @@ -118,7 +118,7 @@ TEST(UpdateRenderables, SingleTile) { tile_1_1_1_1->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 1, 1}}, Found}, // found ideal tile RetainTileDataAction{{1, 0, {1, 1, 1}}, TileNecessity::Required}, // @@ -129,7 +129,7 @@ TEST(UpdateRenderables, SingleTile) { // Check a repeated render with the same data. log.clear(); algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 1, 1}}, Found}, // found ideal tile RetainTileDataAction{{1, 0, {1, 1, 1}}, TileNecessity::Required}, // @@ -141,7 +141,7 @@ TEST(UpdateRenderables, SingleTile) { log.clear(); source.idealTiles.emplace(OverscaledTileID{1, 0, 1}); algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, NotFound}, // missing ideal tile CreateTileDataAction{{1, 0, {1, 0, 1}}}, // create ideal tile @@ -162,7 +162,7 @@ TEST(UpdateRenderables, SingleTile) { log.clear(); source.dataTiles[{1, 0, {1, 0, 1}}]->triedOptional = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, Found}, // missing ideal tile RetainTileDataAction{{1, 0, {1, 0, 1}}, TileNecessity::Required}, // @@ -185,7 +185,7 @@ TEST(UpdateRenderables, SingleTile) { auto tile_1_1_0_1 = source.createTileData(OverscaledTileID{1, 0, 1}); tile_1_1_0_1->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, Found}, // newly added tile RetainTileDataAction{{1, 0, {1, 0, 1}}, TileNecessity::Required}, // @@ -204,7 +204,7 @@ TEST(UpdateRenderables, SingleTile) { auto tile_1_1_0_0 = source.createTileData(OverscaledTileID{1, 0, 0}); algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // found tile, not ready RetainTileDataAction{{1, 0, {1, 0, 0}}, TileNecessity::Required}, // @@ -230,7 +230,7 @@ TEST(UpdateRenderables, SingleTile) { log.clear(); tile_1_1_0_0->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // found tile, now ready RetainTileDataAction{{1, 0, {1, 0, 0}}, TileNecessity::Required}, // @@ -263,7 +263,7 @@ TEST(UpdateRenderables, UseParentTile) { auto tile_0_0_0_0 = source.createTileData(OverscaledTileID{0, 0, 0}); tile_0_0_0_0->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, NotFound}, // missing ideal tile CreateTileDataAction{{1, 0, {1, 0, 1}}}, // @@ -306,7 +306,7 @@ TEST(UpdateRenderables, DontUseWrongParentTile) { auto tile_1_1_1_0 = source.createTileData(OverscaledTileID{1, 1, 0}); tile_1_1_1_0->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, NotFound}, // missing ideal tile CreateTileDataAction{{2, 0, {2, 0, 0}}}, // @@ -324,7 +324,7 @@ TEST(UpdateRenderables, DontUseWrongParentTile) { log.clear(); source.dataTiles[{2, 0, {2, 0, 0}}]->triedOptional = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, Found}, // non-ready ideal tile RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -343,7 +343,7 @@ TEST(UpdateRenderables, DontUseWrongParentTile) { log.clear(); source.idealTiles.emplace(OverscaledTileID{2, 2, 0}); algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, Found}, // non-ready ideal tile RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -388,7 +388,7 @@ TEST(UpdateRenderables, UseParentTileWhenChildNotReady) { // Make sure that it renders the parent tile. algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, Found}, // found, but not ready RetainTileDataAction{{1, 0, {1, 0, 1}}, TileNecessity::Required}, // @@ -406,7 +406,7 @@ TEST(UpdateRenderables, UseParentTileWhenChildNotReady) { log.clear(); tile_1_1_0_1->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, Found}, // found and ready RetainTileDataAction{{1, 0, {1, 0, 1}}, TileNecessity::Required}, // @@ -433,7 +433,7 @@ TEST(UpdateRenderables, UseOverlappingParentTile) { tile_1_1_0_1->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // ideal tile not found CreateTileDataAction{{1, 0, {1, 0, 0}}}, // @@ -469,7 +469,7 @@ TEST(UpdateRenderables, UseChildTiles) { tile_1_1_1_0->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{0, 0, {0, 0, 0}}, NotFound}, // ideal tile, missing CreateTileDataAction{{0, 0, {0, 0, 0}}}, // @@ -503,7 +503,7 @@ TEST(UpdateRenderables, PreferChildTiles) { tile_2_2_0_0->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // ideal tile, not found CreateTileDataAction{{1, 0, {1, 0, 0}}}, // @@ -526,7 +526,7 @@ TEST(UpdateRenderables, PreferChildTiles) { auto tile_2_2_0_1 = source.createTileData(OverscaledTileID{2, 0, 1}); tile_2_2_0_1->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // ideal tile, not ready // ideal tile was added in previous invocation, but is not yet ready @@ -549,7 +549,7 @@ TEST(UpdateRenderables, PreferChildTiles) { auto tile_2_2_1_0 = source.createTileData(OverscaledTileID{2, 1, 0}); tile_2_2_1_0->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // ideal tile, not ready // ideal tile was added in first invocation, but is not yet ready @@ -575,7 +575,7 @@ TEST(UpdateRenderables, PreferChildTiles) { auto tile_2_2_1_1 = source.createTileData(OverscaledTileID{2, 1, 1}); tile_2_2_1_1->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // ideal tile, not ready // ideal tile was added in first invocation, but is not yet ready @@ -613,7 +613,7 @@ TEST(UpdateRenderables, UseParentAndChildTiles) { // Check that it uses the child tile and the parent tile to cover the rest. algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // ideal tile, missing CreateTileDataAction{{1, 0, {1, 0, 0}}}, // @@ -634,7 +634,7 @@ TEST(UpdateRenderables, UseParentAndChildTiles) { log.clear(); source.dataTiles.erase(OverscaledTileID{2, 0, 0}); algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{1, 0, {1, 0, 0}}, TileNecessity::Required}, // @@ -664,7 +664,7 @@ TEST(UpdateRenderables, DontUseTilesLowerThanMinzoom) { tile_1_1_0_0->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, NotFound}, // ideal tile, missing CreateTileDataAction{{2, 0, {2, 0, 0}}}, // @@ -693,7 +693,7 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { auto tile_3_3_0_0 = source.createTileData(OverscaledTileID{3, 0, 0}); tile_3_3_0_0->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, NotFound}, // ideal tile, missing CreateTileDataAction{{2, 0, {2, 0, 0}}}, // @@ -708,7 +708,7 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { log.clear(); source.dataTiles[{2, 0, {2, 0, 0}}]->triedOptional = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, Found}, // ideal tile, missing RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -727,7 +727,7 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { auto tile_2_2_0_0 = source.createTileData(OverscaledTileID{2, 0, {2, 0, 0}}); tile_2_2_0_0->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, NotFound}, // ideal tile, missing CreateTileDataAction{{3, 0, {2, 0, 0}}}, // @@ -744,7 +744,7 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { auto tile_3_2_0_0 = source.createTileData(OverscaledTileID{3, 0, {2, 0, 0}}); tile_3_2_0_0->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, Found}, // RetainTileDataAction{{3, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -757,7 +757,7 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { source.idealTiles.clear(); source.idealTiles.emplace(OverscaledTileID{2, 0, 0}); algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, Found}, // RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -772,7 +772,7 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { // Use the overzoomed tile even though it doesn't match the zoom level. algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, NotFound}, // CreateTileDataAction{{2, 0, {2, 0, 0}}}, // @@ -799,7 +799,7 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) { auto tile_3_2_0_0 = source.createTileData(OverscaledTileID{3, 0, {2, 0, 0}}); tile_3_2_0_0->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, Found}, // RetainTileDataAction{{3, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -814,7 +814,7 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) { auto tile_2_2_0_0 = source.createTileData(OverscaledTileID{2, 0, {2, 0, 0}}); tile_2_2_0_0->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, NotFound}, // CreateTileDataAction{{3, 0, {2, 0, 0}}}, // @@ -833,7 +833,7 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) { auto tile_1_1_0_0 = source.createTileData(OverscaledTileID{1, 0, {1, 0, 0}}); tile_1_1_0_0->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{3, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -849,7 +849,7 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) { log.clear(); source.dataTiles[{3, 0, {2, 0, 0}}]->triedOptional = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{3, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -876,7 +876,7 @@ TEST(UpdateRenderables, DoNotAscendMultipleTimesIfNotFound) { source.idealTiles.emplace(OverscaledTileID{8, 1, 0}); algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{8, 0, {8, 0, 0}}, NotFound}, // ideal tile CreateTileDataAction{{8, 0, {8, 0, 0}}}, // @@ -911,7 +911,7 @@ TEST(UpdateRenderables, DoNotAscendMultipleTimesIfNotFound) { tile_4_0_0_0->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{8, 0, {8, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{8, 0, {8, 0, 0}}, TileNecessity::Required}, // @@ -951,7 +951,7 @@ TEST(UpdateRenderables, DontRetainUnusedNonIdealTiles) { source.createTileData(OverscaledTileID{2, 0, 0}); algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -989,7 +989,7 @@ TEST(UpdateRenderables, WrappedTiles) { tile_0_0_0_0->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ( ActionLog({ GetTileDataAction{{1, -1, {1, 1, 0}}, NotFound}, // ideal tile 1/-1/0 (wrapped to -1) @@ -1044,7 +1044,7 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { source.idealTiles.emplace(OverscaledTileID{6, 0, 0}); algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, NotFound}, // ideal tile, not found CreateTileDataAction{{6, 0, {6, 0, 0}}}, // @@ -1065,7 +1065,7 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { // Repeat. log.clear(); algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1086,7 +1086,7 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { log.clear(); source.dataTiles[{6, 0, {6, 0, 0}}]->triedOptional = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1108,7 +1108,7 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { // Repeat. log.clear(); algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1130,7 +1130,7 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { log.clear(); source.dataTiles[{5, 0, {5, 0, 0}}]->triedOptional = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1154,7 +1154,7 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { log.clear(); source.dataTiles[{4, 0, {4, 0, 0}}]->triedOptional = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1179,7 +1179,7 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { log.clear(); source.dataTiles[{3, 0, {3, 0, 0}}]->triedOptional = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1206,7 +1206,7 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { auto tile_3_3_0_0 = source.dataTiles[{3, 0, {3, 0, 0}}].get(); tile_3_3_0_0->renderable = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1241,7 +1241,7 @@ TEST(UpdateRenderables, LoadRequiredIfIdealTileCantBeFound) { tile_6_6_0_0->loaded = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not found RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1292,7 +1292,7 @@ TEST(UpdateRenderables, LoadOverscaledMaxZoomTile) { tile_1_1_0_0->loaded = true; algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{4, 0, {2, 0, 0}}, Found}, RetainTileDataAction{{4, 0, {2, 0, 0}}, TileNecessity::Required}, @@ -1324,7 +1324,7 @@ TEST(UpdateRenderables, MaxParentOverscaleFactor) { // Set max parent overscale factor to 4, so that tile 0,0,0 would be rendered algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange, 4); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange, 4); EXPECT_EQ(ActionLog({GetTileDataAction{{4, 0, {4, 0, 0}}, NotFound}, // ideal tile CreateTileDataAction{{4, 0, {4, 0, 0}}}, RetainTileDataAction{{4, 0, {4, 0, 0}}, TileNecessity::Required}, @@ -1352,7 +1352,7 @@ TEST(UpdateRenderables, MaxParentOverscaleFactor) { // Set max parent overscale factor to 3. // Parent tile 0,0,0 should not be requested / rendered. algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.zoomRange, 3); + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange, 3); EXPECT_EQ(ActionLog({GetTileDataAction{{4, 0, {4, 0, 0}}, Found}, // ideal tile RetainTileDataAction{{4, 0, {4, 0, 0}}, TileNecessity::Required}, GetTileDataAction{{5, 0, {5, 0, 0}}, NotFound}, // child tiles diff --git a/test/src/mbgl/test/mock.hpp b/test/src/mbgl/test/mock.hpp index 418c3eaf4d6..c12dcb06cf2 100644 --- a/test/src/mbgl/test/mock.hpp +++ b/test/src/mbgl/test/mock.hpp @@ -15,6 +15,7 @@ struct MockSource { mbgl::Range zoomRange{0, 16}; std::map> dataTiles; std::set idealTiles; + std::map> previouslyRenderedTiles; // Test API inline MockTileData* createTileData(const mbgl::OverscaledTileID& tileID); From 5f8b6b2d224432d67de3f63febca44fc81b9cb55 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 31 Jul 2024 18:04:22 +0000 Subject: [PATCH 05/19] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- test/algorithm/update_renderables.test.cpp | 434 ++++++++++++++++----- 1 file changed, 338 insertions(+), 96 deletions(-) diff --git a/test/algorithm/update_renderables.test.cpp b/test/algorithm/update_renderables.test.cpp index d1e6884f0a2..4bfbb69d040 100644 --- a/test/algorithm/update_renderables.test.cpp +++ b/test/algorithm/update_renderables.test.cpp @@ -117,8 +117,13 @@ TEST(UpdateRenderables, SingleTile) { auto tile_1_1_1_1 = source.createTileData(OverscaledTileID{1, 1, 1}); tile_1_1_1_1->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 1, 1}}, Found}, // found ideal tile RetainTileDataAction{{1, 0, {1, 1, 1}}, TileNecessity::Required}, // @@ -128,8 +133,13 @@ TEST(UpdateRenderables, SingleTile) { // Check a repeated render with the same data. log.clear(); - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 1, 1}}, Found}, // found ideal tile RetainTileDataAction{{1, 0, {1, 1, 1}}, TileNecessity::Required}, // @@ -140,8 +150,13 @@ TEST(UpdateRenderables, SingleTile) { // Insert a tile we don't have data for. log.clear(); source.idealTiles.emplace(OverscaledTileID{1, 0, 1}); - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, NotFound}, // missing ideal tile CreateTileDataAction{{1, 0, {1, 0, 1}}}, // create ideal tile @@ -161,8 +176,13 @@ TEST(UpdateRenderables, SingleTile) { // Mark the created tile as having the optional request tried. log.clear(); source.dataTiles[{1, 0, {1, 0, 1}}]->triedOptional = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, Found}, // missing ideal tile RetainTileDataAction{{1, 0, {1, 0, 1}}, TileNecessity::Required}, // @@ -184,8 +204,13 @@ TEST(UpdateRenderables, SingleTile) { log.clear(); auto tile_1_1_0_1 = source.createTileData(OverscaledTileID{1, 0, 1}); tile_1_1_0_1->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, Found}, // newly added tile RetainTileDataAction{{1, 0, {1, 0, 1}}, TileNecessity::Required}, // @@ -203,8 +228,13 @@ TEST(UpdateRenderables, SingleTile) { source.idealTiles.emplace(OverscaledTileID{1, 0, 0}); auto tile_1_1_0_0 = source.createTileData(OverscaledTileID{1, 0, 0}); - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // found tile, not ready RetainTileDataAction{{1, 0, {1, 0, 0}}, TileNecessity::Required}, // @@ -229,8 +259,13 @@ TEST(UpdateRenderables, SingleTile) { // Then, add the bucket and check that it's getting used. log.clear(); tile_1_1_0_0->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // found tile, now ready RetainTileDataAction{{1, 0, {1, 0, 0}}, TileNecessity::Required}, // @@ -262,8 +297,13 @@ TEST(UpdateRenderables, UseParentTile) { // Make sure that we're getting the tile back. auto tile_0_0_0_0 = source.createTileData(OverscaledTileID{0, 0, 0}); tile_0_0_0_0->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, NotFound}, // missing ideal tile CreateTileDataAction{{1, 0, {1, 0, 1}}}, // @@ -305,8 +345,13 @@ TEST(UpdateRenderables, DontUseWrongParentTile) { auto tile_1_1_1_0 = source.createTileData(OverscaledTileID{1, 1, 0}); tile_1_1_1_0->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, NotFound}, // missing ideal tile CreateTileDataAction{{2, 0, {2, 0, 0}}}, // @@ -323,8 +368,13 @@ TEST(UpdateRenderables, DontUseWrongParentTile) { // Now mark the created tile as having the optional request tried. log.clear(); source.dataTiles[{2, 0, {2, 0, 0}}]->triedOptional = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, Found}, // non-ready ideal tile RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -342,8 +392,13 @@ TEST(UpdateRenderables, DontUseWrongParentTile) { // Add a new child tile and check that it is now used. log.clear(); source.idealTiles.emplace(OverscaledTileID{2, 2, 0}); - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, Found}, // non-ready ideal tile RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -387,8 +442,13 @@ TEST(UpdateRenderables, UseParentTileWhenChildNotReady) { // Don't create bucket. // Make sure that it renders the parent tile. - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, Found}, // found, but not ready RetainTileDataAction{{1, 0, {1, 0, 1}}, TileNecessity::Required}, // @@ -405,8 +465,13 @@ TEST(UpdateRenderables, UseParentTileWhenChildNotReady) { // Now insert the bucket and make sure we're now using the matching tile log.clear(); tile_1_1_0_1->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, Found}, // found and ready RetainTileDataAction{{1, 0, {1, 0, 1}}, TileNecessity::Required}, // @@ -432,8 +497,13 @@ TEST(UpdateRenderables, UseOverlappingParentTile) { auto tile_1_1_0_1 = source.createTileData(OverscaledTileID{1, 0, 1}); tile_1_1_0_1->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // ideal tile not found CreateTileDataAction{{1, 0, {1, 0, 0}}}, // @@ -468,8 +538,13 @@ TEST(UpdateRenderables, UseChildTiles) { auto tile_1_1_1_0 = source.createTileData(OverscaledTileID{1, 1, 0}); tile_1_1_1_0->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{0, 0, {0, 0, 0}}, NotFound}, // ideal tile, missing CreateTileDataAction{{0, 0, {0, 0, 0}}}, // @@ -502,8 +577,13 @@ TEST(UpdateRenderables, PreferChildTiles) { auto tile_2_2_0_0 = source.createTileData(OverscaledTileID{2, 0, 0}); tile_2_2_0_0->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // ideal tile, not found CreateTileDataAction{{1, 0, {1, 0, 0}}}, // @@ -525,8 +605,13 @@ TEST(UpdateRenderables, PreferChildTiles) { log.clear(); auto tile_2_2_0_1 = source.createTileData(OverscaledTileID{2, 0, 1}); tile_2_2_0_1->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // ideal tile, not ready // ideal tile was added in previous invocation, but is not yet ready @@ -548,8 +633,13 @@ TEST(UpdateRenderables, PreferChildTiles) { log.clear(); auto tile_2_2_1_0 = source.createTileData(OverscaledTileID{2, 1, 0}); tile_2_2_1_0->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // ideal tile, not ready // ideal tile was added in first invocation, but is not yet ready @@ -574,8 +664,13 @@ TEST(UpdateRenderables, PreferChildTiles) { log.clear(); auto tile_2_2_1_1 = source.createTileData(OverscaledTileID{2, 1, 1}); tile_2_2_1_1->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // ideal tile, not ready // ideal tile was added in first invocation, but is not yet ready @@ -612,8 +707,13 @@ TEST(UpdateRenderables, UseParentAndChildTiles) { tile_2_2_0_0->renderable = true; // Check that it uses the child tile and the parent tile to cover the rest. - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // ideal tile, missing CreateTileDataAction{{1, 0, {1, 0, 0}}}, // @@ -633,8 +733,13 @@ TEST(UpdateRenderables, UseParentAndChildTiles) { // Then, remove the child tile and check that it now only the parent tile. log.clear(); source.dataTiles.erase(OverscaledTileID{2, 0, 0}); - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{1, 0, {1, 0, 0}}, TileNecessity::Required}, // @@ -663,8 +768,13 @@ TEST(UpdateRenderables, DontUseTilesLowerThanMinzoom) { auto tile_1_1_0_0 = source.createTileData(OverscaledTileID{1, 0, 0}); tile_1_1_0_0->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, NotFound}, // ideal tile, missing CreateTileDataAction{{2, 0, {2, 0, 0}}}, // @@ -692,8 +802,13 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { // Add a child tile (that should never occur in practice) and make sure it's not selected. auto tile_3_3_0_0 = source.createTileData(OverscaledTileID{3, 0, 0}); tile_3_3_0_0->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, NotFound}, // ideal tile, missing CreateTileDataAction{{2, 0, {2, 0, 0}}}, // @@ -707,8 +822,13 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { // Mark the created tile as having tried the optional request. log.clear(); source.dataTiles[{2, 0, {2, 0, 0}}]->triedOptional = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, Found}, // ideal tile, missing RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -726,8 +846,13 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { source.idealTiles.emplace(OverscaledTileID{3, 0, {2, 0, 0}}); auto tile_2_2_0_0 = source.createTileData(OverscaledTileID{2, 0, {2, 0, 0}}); tile_2_2_0_0->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, NotFound}, // ideal tile, missing CreateTileDataAction{{3, 0, {2, 0, 0}}}, // @@ -743,8 +868,13 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { log.clear(); auto tile_3_2_0_0 = source.createTileData(OverscaledTileID{3, 0, {2, 0, 0}}); tile_3_2_0_0->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, Found}, // RetainTileDataAction{{3, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -756,8 +886,13 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { log.clear(); source.idealTiles.clear(); source.idealTiles.emplace(OverscaledTileID{2, 0, 0}); - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, Found}, // RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -771,8 +906,13 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { tile_2_2_0_0 = nullptr; // Use the overzoomed tile even though it doesn't match the zoom level. - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, NotFound}, // CreateTileDataAction{{2, 0, {2, 0, 0}}}, // @@ -798,8 +938,13 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) { // Add a matching overzoomed tile and make sure it gets selected. auto tile_3_2_0_0 = source.createTileData(OverscaledTileID{3, 0, {2, 0, 0}}); tile_3_2_0_0->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, Found}, // RetainTileDataAction{{3, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -813,8 +958,13 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) { tile_3_2_0_0 = nullptr; auto tile_2_2_0_0 = source.createTileData(OverscaledTileID{2, 0, {2, 0, 0}}); tile_2_2_0_0->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, NotFound}, // CreateTileDataAction{{3, 0, {2, 0, 0}}}, // @@ -832,8 +982,13 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) { tile_2_2_0_0 = nullptr; auto tile_1_1_0_0 = source.createTileData(OverscaledTileID{1, 0, {1, 0, 0}}); tile_1_1_0_0->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{3, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -848,8 +1003,13 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) { // Now, mark the created tile as found. log.clear(); source.dataTiles[{3, 0, {2, 0, 0}}]->triedOptional = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{3, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -875,8 +1035,13 @@ TEST(UpdateRenderables, DoNotAscendMultipleTimesIfNotFound) { source.idealTiles.emplace(OverscaledTileID{8, 0, 0}); source.idealTiles.emplace(OverscaledTileID{8, 1, 0}); - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{8, 0, {8, 0, 0}}, NotFound}, // ideal tile CreateTileDataAction{{8, 0, {8, 0, 0}}}, // @@ -910,8 +1075,13 @@ TEST(UpdateRenderables, DoNotAscendMultipleTimesIfNotFound) { auto tile_4_0_0_0 = source.createTileData(OverscaledTileID{4, 0, {4, 0, 0}}); tile_4_0_0_0->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{8, 0, {8, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{8, 0, {8, 0, 0}}, TileNecessity::Required}, // @@ -950,8 +1120,13 @@ TEST(UpdateRenderables, DontRetainUnusedNonIdealTiles) { source.createTileData(OverscaledTileID{1, 0, 0}); source.createTileData(OverscaledTileID{2, 0, 0}); - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -988,8 +1163,13 @@ TEST(UpdateRenderables, WrappedTiles) { auto tile_0_0_0_0 = source.createTileData(OverscaledTileID{0, 0, {0, 0, 0}}); tile_0_0_0_0->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ( ActionLog({ GetTileDataAction{{1, -1, {1, 1, 0}}, NotFound}, // ideal tile 1/-1/0 (wrapped to -1) @@ -1043,8 +1223,13 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { source.idealTiles.emplace(OverscaledTileID{6, 0, 0}); - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, NotFound}, // ideal tile, not found CreateTileDataAction{{6, 0, {6, 0, 0}}}, // @@ -1064,8 +1249,13 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { // Repeat. log.clear(); - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1085,8 +1275,13 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { // Mark next level has having tried optional. log.clear(); source.dataTiles[{6, 0, {6, 0, 0}}]->triedOptional = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1107,8 +1302,13 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { // Repeat. log.clear(); - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1129,8 +1329,13 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { // Mark next level has having tried optional. log.clear(); source.dataTiles[{5, 0, {5, 0, 0}}]->triedOptional = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1153,8 +1358,13 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { // Mark next level has having tried optional. log.clear(); source.dataTiles[{4, 0, {4, 0, 0}}]->triedOptional = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1178,8 +1388,13 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { // Mark next level has having tried optional. log.clear(); source.dataTiles[{3, 0, {3, 0, 0}}]->triedOptional = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1205,8 +1420,13 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { log.clear(); auto tile_3_3_0_0 = source.dataTiles[{3, 0, {3, 0, 0}}].get(); tile_3_3_0_0->renderable = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1240,8 +1460,13 @@ TEST(UpdateRenderables, LoadRequiredIfIdealTileCantBeFound) { tile_6_6_0_0->triedOptional = true; tile_6_6_0_0->loaded = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not found RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1291,8 +1516,13 @@ TEST(UpdateRenderables, LoadOverscaledMaxZoomTile) { tile_1_1_0_0->triedOptional = true; tile_1_1_0_0->loaded = true; - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{4, 0, {2, 0, 0}}, Found}, RetainTileDataAction{{4, 0, {2, 0, 0}}, TileNecessity::Required}, @@ -1323,8 +1553,14 @@ TEST(UpdateRenderables, MaxParentOverscaleFactor) { tile_0_0_0_0->renderable = true; // Set max parent overscale factor to 4, so that tile 0,0,0 would be rendered - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange, 4); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange, + 4); EXPECT_EQ(ActionLog({GetTileDataAction{{4, 0, {4, 0, 0}}, NotFound}, // ideal tile CreateTileDataAction{{4, 0, {4, 0, 0}}}, RetainTileDataAction{{4, 0, {4, 0, 0}}, TileNecessity::Required}, @@ -1351,8 +1587,14 @@ TEST(UpdateRenderables, MaxParentOverscaleFactor) { // Set max parent overscale factor to 3. // Parent tile 0,0,0 should not be requested / rendered. - algorithm::updateRenderables( - getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.previouslyRenderedTiles, source.zoomRange, 3); + algorithm::updateRenderables(getTileData, + createTileData, + retainTileData, + renderTile, + source.idealTiles, + source.previouslyRenderedTiles, + source.zoomRange, + 3); EXPECT_EQ(ActionLog({GetTileDataAction{{4, 0, {4, 0, 0}}, Found}, // ideal tile RetainTileDataAction{{4, 0, {4, 0, 0}}, TileNecessity::Required}, GetTileDataAction{{5, 0, {5, 0, 0}}, NotFound}, // child tiles From 3a6fbfa8996631cd22b67827f07e37b83419c6f4 Mon Sep 17 00:00:00 2001 From: Alex Cristici Date: Wed, 31 Jul 2024 21:24:05 +0300 Subject: [PATCH 06/19] Cpp unit tests fixes. --- src/mbgl/algorithm/update_renderables.hpp | 7 ++++--- test/src/mbgl/test/mock.hpp | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mbgl/algorithm/update_renderables.hpp b/src/mbgl/algorithm/update_renderables.hpp index 1c57609c19a..f8796723dd9 100644 --- a/src/mbgl/algorithm/update_renderables.hpp +++ b/src/mbgl/algorithm/update_renderables.hpp @@ -14,13 +14,14 @@ template + typename IdealTileIDs, + typename TileData> void updateRenderables(GetTileFn getTile, CreateTileFn createTile, RetainTileFn retainTile, RenderTileFn renderTile, const IdealTileIDs& idealTileIDs, - const std::map> previouslyRenderedTiles, + const std::map> previouslyRenderedTiles, const Range& zoomRange, const std::optional& maxParentOverscaleFactor = std::nullopt) { std::unordered_set checked; @@ -59,7 +60,7 @@ void updateRenderables(GetTileFn getTile, auto addPreviouslyRenderedTilesIfChildrenOf = [&](const UnwrappedTileID& tileID) { for (auto previouslyRenderedTileIt : previouslyRenderedTiles) { const UnwrappedTileID previouslyRenderedTileID = previouslyRenderedTileIt.first; - Tile& previouslyRenderedTile = previouslyRenderedTileIt.second; + TileData& previouslyRenderedTile = previouslyRenderedTileIt.second; if (previouslyRenderedTileID == tileID || previouslyRenderedTileID.isChildOf(tileID)) { retainTile(previouslyRenderedTile, TileNecessity::Optional); renderTile(previouslyRenderedTileID, previouslyRenderedTile); diff --git a/test/src/mbgl/test/mock.hpp b/test/src/mbgl/test/mock.hpp index c12dcb06cf2..4bffd1ab3e0 100644 --- a/test/src/mbgl/test/mock.hpp +++ b/test/src/mbgl/test/mock.hpp @@ -15,7 +15,7 @@ struct MockSource { mbgl::Range zoomRange{0, 16}; std::map> dataTiles; std::set idealTiles; - std::map> previouslyRenderedTiles; + std::map> previouslyRenderedTiles; // Test API inline MockTileData* createTileData(const mbgl::OverscaledTileID& tileID); From 1f1afccc34d7f0661ad71e60bdf003de89afb536 Mon Sep 17 00:00:00 2001 From: Alex Cristici Date: Thu, 1 Aug 2024 10:28:32 +0300 Subject: [PATCH 07/19] Improved from using previously rendered tiles to prefetched tiles in order to fix an issue when zooming out many levels. --- src/mbgl/algorithm/update_renderables.hpp | 24 +++--- src/mbgl/renderer/tile_pyramid.cpp | 6 +- test/algorithm/update_renderables.test.cpp | 96 +++++++++++----------- test/src/mbgl/test/mock.hpp | 1 - 4 files changed, 64 insertions(+), 63 deletions(-) diff --git a/src/mbgl/algorithm/update_renderables.hpp b/src/mbgl/algorithm/update_renderables.hpp index f8796723dd9..830d0b6ff86 100644 --- a/src/mbgl/algorithm/update_renderables.hpp +++ b/src/mbgl/algorithm/update_renderables.hpp @@ -21,7 +21,7 @@ void updateRenderables(GetTileFn getTile, RetainTileFn retainTile, RenderTileFn renderTile, const IdealTileIDs& idealTileIDs, - const std::map> previouslyRenderedTiles, + const std::map>& prefetchedTiles, const Range& zoomRange, const std::optional& maxParentOverscaleFactor = std::nullopt) { std::unordered_set checked; @@ -57,13 +57,13 @@ void updateRenderables(GetTileFn getTile, // The tile isn't loaded yet, but retain it anyway because it's an ideal tile. retainTile(*tile, TileNecessity::Required); - auto addPreviouslyRenderedTilesIfChildrenOf = [&](const UnwrappedTileID& tileID) { - for (auto previouslyRenderedTileIt : previouslyRenderedTiles) { - const UnwrappedTileID previouslyRenderedTileID = previouslyRenderedTileIt.first; - TileData& previouslyRenderedTile = previouslyRenderedTileIt.second; - if (previouslyRenderedTileID == tileID || previouslyRenderedTileID.isChildOf(tileID)) { - retainTile(previouslyRenderedTile, TileNecessity::Optional); - renderTile(previouslyRenderedTileID, previouslyRenderedTile); + auto addPrefetchedTilesIfChildrenOf = [&](const UnwrappedTileID& tileID) { + for (auto& prefetchedTileIt : prefetchedTiles) { + const UnwrappedTileID prefetchedTileID = prefetchedTileIt.first.toUnwrapped(); + TileData* prefetchedTile = prefetchedTileIt.second.get(); + if (prefetchedTile->isRenderable() && (prefetchedTileID == tileID || prefetchedTileID.isChildOf(tileID))) { + retainTile(*prefetchedTile, TileNecessity::Optional); + renderTile(prefetchedTileID, *prefetchedTile); } } }; @@ -80,8 +80,8 @@ void updateRenderables(GetTileFn getTile, } else { covered = false; - // Reuse previously rendered tiles in order to avoid empty screen - addPreviouslyRenderedTilesIfChildrenOf(idealRenderTileID); + // Reuse prefetched tiles in order to avoid empty screen + addPrefetchedTilesIfChildrenOf(idealRenderTileID); } } else { // Check all four actual child tiles. @@ -96,8 +96,8 @@ void updateRenderables(GetTileFn getTile, // going to look for parents as well. covered = false; - // Reuse previously rendered tiles in order to avoid empty screen - addPreviouslyRenderedTilesIfChildrenOf(childDataTileID.toUnwrapped()); + // Reuse prefetched tiles in order to avoid empty screen + addPrefetchedTilesIfChildrenOf(childDataTileID.toUnwrapped()); } } } diff --git a/src/mbgl/renderer/tile_pyramid.cpp b/src/mbgl/renderer/tile_pyramid.cpp index 2cd89ab9b1a..5b6cbe77630 100644 --- a/src/mbgl/renderer/tile_pyramid.cpp +++ b/src/mbgl/renderer/tile_pyramid.cpp @@ -122,6 +122,8 @@ void TilePyramid::update(const std::vector>& l if (panZoom < idealZoom) { panTiles = util::tileCover(parameters.transformState, panZoom); + } else { + panTiles = util::tileCover(parameters.transformState, idealZoom, panZoom); } } @@ -197,7 +199,7 @@ void TilePyramid::update(const std::vector>& l retainTileFn, [](const UnwrappedTileID&, Tile&) {}, panTiles, - previouslyRenderedTiles, + tiles, zoomRange, maxParentTileOverscaleFactor); } @@ -207,7 +209,7 @@ void TilePyramid::update(const std::vector>& l retainTileFn, renderTileFn, idealTiles, - previouslyRenderedTiles, + tiles, zoomRange, maxParentTileOverscaleFactor); diff --git a/test/algorithm/update_renderables.test.cpp b/test/algorithm/update_renderables.test.cpp index 4bfbb69d040..6d92f753014 100644 --- a/test/algorithm/update_renderables.test.cpp +++ b/test/algorithm/update_renderables.test.cpp @@ -122,7 +122,7 @@ TEST(UpdateRenderables, SingleTile) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 1, 1}}, Found}, // found ideal tile @@ -138,7 +138,7 @@ TEST(UpdateRenderables, SingleTile) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 1, 1}}, Found}, // found ideal tile @@ -155,7 +155,7 @@ TEST(UpdateRenderables, SingleTile) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, NotFound}, // missing ideal tile @@ -181,7 +181,7 @@ TEST(UpdateRenderables, SingleTile) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, Found}, // missing ideal tile @@ -209,7 +209,7 @@ TEST(UpdateRenderables, SingleTile) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, Found}, // newly added tile @@ -233,7 +233,7 @@ TEST(UpdateRenderables, SingleTile) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // found tile, not ready @@ -264,7 +264,7 @@ TEST(UpdateRenderables, SingleTile) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // found tile, now ready @@ -302,7 +302,7 @@ TEST(UpdateRenderables, UseParentTile) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, NotFound}, // missing ideal tile @@ -350,7 +350,7 @@ TEST(UpdateRenderables, DontUseWrongParentTile) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, NotFound}, // missing ideal tile @@ -373,7 +373,7 @@ TEST(UpdateRenderables, DontUseWrongParentTile) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, Found}, // non-ready ideal tile @@ -397,7 +397,7 @@ TEST(UpdateRenderables, DontUseWrongParentTile) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, Found}, // non-ready ideal tile @@ -447,7 +447,7 @@ TEST(UpdateRenderables, UseParentTileWhenChildNotReady) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, Found}, // found, but not ready @@ -470,7 +470,7 @@ TEST(UpdateRenderables, UseParentTileWhenChildNotReady) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, Found}, // found and ready @@ -502,7 +502,7 @@ TEST(UpdateRenderables, UseOverlappingParentTile) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // ideal tile not found @@ -543,7 +543,7 @@ TEST(UpdateRenderables, UseChildTiles) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{0, 0, {0, 0, 0}}, NotFound}, // ideal tile, missing @@ -582,7 +582,7 @@ TEST(UpdateRenderables, PreferChildTiles) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // ideal tile, not found @@ -610,7 +610,7 @@ TEST(UpdateRenderables, PreferChildTiles) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // ideal tile, not ready @@ -638,7 +638,7 @@ TEST(UpdateRenderables, PreferChildTiles) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // ideal tile, not ready @@ -669,7 +669,7 @@ TEST(UpdateRenderables, PreferChildTiles) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // ideal tile, not ready @@ -712,7 +712,7 @@ TEST(UpdateRenderables, UseParentAndChildTiles) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // ideal tile, missing @@ -738,7 +738,7 @@ TEST(UpdateRenderables, UseParentAndChildTiles) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // ideal tile, not ready @@ -773,7 +773,7 @@ TEST(UpdateRenderables, DontUseTilesLowerThanMinzoom) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, NotFound}, // ideal tile, missing @@ -807,7 +807,7 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, NotFound}, // ideal tile, missing @@ -827,7 +827,7 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, Found}, // ideal tile, missing @@ -851,7 +851,7 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, NotFound}, // ideal tile, missing @@ -873,7 +873,7 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, Found}, // @@ -891,7 +891,7 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, Found}, // @@ -911,7 +911,7 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, NotFound}, // @@ -943,7 +943,7 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, Found}, // @@ -963,7 +963,7 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, NotFound}, // @@ -987,7 +987,7 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, Found}, // ideal tile, not ready @@ -1008,7 +1008,7 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, Found}, // ideal tile, not ready @@ -1040,7 +1040,7 @@ TEST(UpdateRenderables, DoNotAscendMultipleTimesIfNotFound) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{8, 0, {8, 0, 0}}, NotFound}, // ideal tile @@ -1080,7 +1080,7 @@ TEST(UpdateRenderables, DoNotAscendMultipleTimesIfNotFound) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{8, 0, {8, 0, 0}}, Found}, // ideal tile, not ready @@ -1125,7 +1125,7 @@ TEST(UpdateRenderables, DontRetainUnusedNonIdealTiles) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, Found}, // ideal tile, not ready @@ -1168,7 +1168,7 @@ TEST(UpdateRenderables, WrappedTiles) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ( ActionLog({ @@ -1228,7 +1228,7 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, NotFound}, // ideal tile, not found @@ -1254,7 +1254,7 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready @@ -1280,7 +1280,7 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready @@ -1307,7 +1307,7 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready @@ -1334,7 +1334,7 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready @@ -1363,7 +1363,7 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready @@ -1393,7 +1393,7 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready @@ -1425,7 +1425,7 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready @@ -1465,7 +1465,7 @@ TEST(UpdateRenderables, LoadRequiredIfIdealTileCantBeFound) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not found @@ -1521,7 +1521,7 @@ TEST(UpdateRenderables, LoadOverscaledMaxZoomTile) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{4, 0, {2, 0, 0}}, Found}, @@ -1558,7 +1558,7 @@ TEST(UpdateRenderables, MaxParentOverscaleFactor) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange, 4); EXPECT_EQ(ActionLog({GetTileDataAction{{4, 0, {4, 0, 0}}, NotFound}, // ideal tile @@ -1592,7 +1592,7 @@ TEST(UpdateRenderables, MaxParentOverscaleFactor) { retainTileData, renderTile, source.idealTiles, - source.previouslyRenderedTiles, + source.dataTiles, source.zoomRange, 3); EXPECT_EQ(ActionLog({GetTileDataAction{{4, 0, {4, 0, 0}}, Found}, // ideal tile diff --git a/test/src/mbgl/test/mock.hpp b/test/src/mbgl/test/mock.hpp index 4bffd1ab3e0..418c3eaf4d6 100644 --- a/test/src/mbgl/test/mock.hpp +++ b/test/src/mbgl/test/mock.hpp @@ -15,7 +15,6 @@ struct MockSource { mbgl::Range zoomRange{0, 16}; std::map> dataTiles; std::set idealTiles; - std::map> previouslyRenderedTiles; // Test API inline MockTileData* createTileData(const mbgl::OverscaledTileID& tileID); From 933984dca6efaafdeafa98f88c5e84984a2b5cee Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 07:29:18 +0000 Subject: [PATCH 08/19] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/mbgl/algorithm/update_renderables.hpp | 3 +- test/algorithm/update_renderables.test.cpp | 414 +++++---------------- 2 files changed, 94 insertions(+), 323 deletions(-) diff --git a/src/mbgl/algorithm/update_renderables.hpp b/src/mbgl/algorithm/update_renderables.hpp index 830d0b6ff86..236423671ef 100644 --- a/src/mbgl/algorithm/update_renderables.hpp +++ b/src/mbgl/algorithm/update_renderables.hpp @@ -61,7 +61,8 @@ void updateRenderables(GetTileFn getTile, for (auto& prefetchedTileIt : prefetchedTiles) { const UnwrappedTileID prefetchedTileID = prefetchedTileIt.first.toUnwrapped(); TileData* prefetchedTile = prefetchedTileIt.second.get(); - if (prefetchedTile->isRenderable() && (prefetchedTileID == tileID || prefetchedTileID.isChildOf(tileID))) { + if (prefetchedTile->isRenderable() && + (prefetchedTileID == tileID || prefetchedTileID.isChildOf(tileID))) { retainTile(*prefetchedTile, TileNecessity::Optional); renderTile(prefetchedTileID, *prefetchedTile); } diff --git a/test/algorithm/update_renderables.test.cpp b/test/algorithm/update_renderables.test.cpp index 6d92f753014..a74a7c54195 100644 --- a/test/algorithm/update_renderables.test.cpp +++ b/test/algorithm/update_renderables.test.cpp @@ -117,13 +117,8 @@ TEST(UpdateRenderables, SingleTile) { auto tile_1_1_1_1 = source.createTileData(OverscaledTileID{1, 1, 1}); tile_1_1_1_1->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 1, 1}}, Found}, // found ideal tile RetainTileDataAction{{1, 0, {1, 1, 1}}, TileNecessity::Required}, // @@ -133,13 +128,8 @@ TEST(UpdateRenderables, SingleTile) { // Check a repeated render with the same data. log.clear(); - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 1, 1}}, Found}, // found ideal tile RetainTileDataAction{{1, 0, {1, 1, 1}}, TileNecessity::Required}, // @@ -150,13 +140,8 @@ TEST(UpdateRenderables, SingleTile) { // Insert a tile we don't have data for. log.clear(); source.idealTiles.emplace(OverscaledTileID{1, 0, 1}); - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, NotFound}, // missing ideal tile CreateTileDataAction{{1, 0, {1, 0, 1}}}, // create ideal tile @@ -176,13 +161,8 @@ TEST(UpdateRenderables, SingleTile) { // Mark the created tile as having the optional request tried. log.clear(); source.dataTiles[{1, 0, {1, 0, 1}}]->triedOptional = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, Found}, // missing ideal tile RetainTileDataAction{{1, 0, {1, 0, 1}}, TileNecessity::Required}, // @@ -204,13 +184,8 @@ TEST(UpdateRenderables, SingleTile) { log.clear(); auto tile_1_1_0_1 = source.createTileData(OverscaledTileID{1, 0, 1}); tile_1_1_0_1->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, Found}, // newly added tile RetainTileDataAction{{1, 0, {1, 0, 1}}, TileNecessity::Required}, // @@ -228,13 +203,8 @@ TEST(UpdateRenderables, SingleTile) { source.idealTiles.emplace(OverscaledTileID{1, 0, 0}); auto tile_1_1_0_0 = source.createTileData(OverscaledTileID{1, 0, 0}); - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // found tile, not ready RetainTileDataAction{{1, 0, {1, 0, 0}}, TileNecessity::Required}, // @@ -259,13 +229,8 @@ TEST(UpdateRenderables, SingleTile) { // Then, add the bucket and check that it's getting used. log.clear(); tile_1_1_0_0->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // found tile, now ready RetainTileDataAction{{1, 0, {1, 0, 0}}, TileNecessity::Required}, // @@ -297,13 +262,8 @@ TEST(UpdateRenderables, UseParentTile) { // Make sure that we're getting the tile back. auto tile_0_0_0_0 = source.createTileData(OverscaledTileID{0, 0, 0}); tile_0_0_0_0->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, NotFound}, // missing ideal tile CreateTileDataAction{{1, 0, {1, 0, 1}}}, // @@ -345,13 +305,8 @@ TEST(UpdateRenderables, DontUseWrongParentTile) { auto tile_1_1_1_0 = source.createTileData(OverscaledTileID{1, 1, 0}); tile_1_1_1_0->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, NotFound}, // missing ideal tile CreateTileDataAction{{2, 0, {2, 0, 0}}}, // @@ -368,13 +323,8 @@ TEST(UpdateRenderables, DontUseWrongParentTile) { // Now mark the created tile as having the optional request tried. log.clear(); source.dataTiles[{2, 0, {2, 0, 0}}]->triedOptional = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, Found}, // non-ready ideal tile RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -392,13 +342,8 @@ TEST(UpdateRenderables, DontUseWrongParentTile) { // Add a new child tile and check that it is now used. log.clear(); source.idealTiles.emplace(OverscaledTileID{2, 2, 0}); - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, Found}, // non-ready ideal tile RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -442,13 +387,8 @@ TEST(UpdateRenderables, UseParentTileWhenChildNotReady) { // Don't create bucket. // Make sure that it renders the parent tile. - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, Found}, // found, but not ready RetainTileDataAction{{1, 0, {1, 0, 1}}, TileNecessity::Required}, // @@ -465,13 +405,8 @@ TEST(UpdateRenderables, UseParentTileWhenChildNotReady) { // Now insert the bucket and make sure we're now using the matching tile log.clear(); tile_1_1_0_1->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 1}}, Found}, // found and ready RetainTileDataAction{{1, 0, {1, 0, 1}}, TileNecessity::Required}, // @@ -497,13 +432,8 @@ TEST(UpdateRenderables, UseOverlappingParentTile) { auto tile_1_1_0_1 = source.createTileData(OverscaledTileID{1, 0, 1}); tile_1_1_0_1->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // ideal tile not found CreateTileDataAction{{1, 0, {1, 0, 0}}}, // @@ -538,13 +468,8 @@ TEST(UpdateRenderables, UseChildTiles) { auto tile_1_1_1_0 = source.createTileData(OverscaledTileID{1, 1, 0}); tile_1_1_1_0->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{0, 0, {0, 0, 0}}, NotFound}, // ideal tile, missing CreateTileDataAction{{0, 0, {0, 0, 0}}}, // @@ -577,13 +502,8 @@ TEST(UpdateRenderables, PreferChildTiles) { auto tile_2_2_0_0 = source.createTileData(OverscaledTileID{2, 0, 0}); tile_2_2_0_0->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // ideal tile, not found CreateTileDataAction{{1, 0, {1, 0, 0}}}, // @@ -605,13 +525,8 @@ TEST(UpdateRenderables, PreferChildTiles) { log.clear(); auto tile_2_2_0_1 = source.createTileData(OverscaledTileID{2, 0, 1}); tile_2_2_0_1->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // ideal tile, not ready // ideal tile was added in previous invocation, but is not yet ready @@ -633,13 +548,8 @@ TEST(UpdateRenderables, PreferChildTiles) { log.clear(); auto tile_2_2_1_0 = source.createTileData(OverscaledTileID{2, 1, 0}); tile_2_2_1_0->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // ideal tile, not ready // ideal tile was added in first invocation, but is not yet ready @@ -664,13 +574,8 @@ TEST(UpdateRenderables, PreferChildTiles) { log.clear(); auto tile_2_2_1_1 = source.createTileData(OverscaledTileID{2, 1, 1}); tile_2_2_1_1->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // ideal tile, not ready // ideal tile was added in first invocation, but is not yet ready @@ -707,13 +612,8 @@ TEST(UpdateRenderables, UseParentAndChildTiles) { tile_2_2_0_0->renderable = true; // Check that it uses the child tile and the parent tile to cover the rest. - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // ideal tile, missing CreateTileDataAction{{1, 0, {1, 0, 0}}}, // @@ -733,13 +633,8 @@ TEST(UpdateRenderables, UseParentAndChildTiles) { // Then, remove the child tile and check that it now only the parent tile. log.clear(); source.dataTiles.erase(OverscaledTileID{2, 0, 0}); - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{1, 0, {1, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{1, 0, {1, 0, 0}}, TileNecessity::Required}, // @@ -768,13 +663,8 @@ TEST(UpdateRenderables, DontUseTilesLowerThanMinzoom) { auto tile_1_1_0_0 = source.createTileData(OverscaledTileID{1, 0, 0}); tile_1_1_0_0->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, NotFound}, // ideal tile, missing CreateTileDataAction{{2, 0, {2, 0, 0}}}, // @@ -802,13 +692,8 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { // Add a child tile (that should never occur in practice) and make sure it's not selected. auto tile_3_3_0_0 = source.createTileData(OverscaledTileID{3, 0, 0}); tile_3_3_0_0->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, NotFound}, // ideal tile, missing CreateTileDataAction{{2, 0, {2, 0, 0}}}, // @@ -822,13 +707,8 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { // Mark the created tile as having tried the optional request. log.clear(); source.dataTiles[{2, 0, {2, 0, 0}}]->triedOptional = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, Found}, // ideal tile, missing RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -846,13 +726,8 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { source.idealTiles.emplace(OverscaledTileID{3, 0, {2, 0, 0}}); auto tile_2_2_0_0 = source.createTileData(OverscaledTileID{2, 0, {2, 0, 0}}); tile_2_2_0_0->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, NotFound}, // ideal tile, missing CreateTileDataAction{{3, 0, {2, 0, 0}}}, // @@ -868,13 +743,8 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { log.clear(); auto tile_3_2_0_0 = source.createTileData(OverscaledTileID{3, 0, {2, 0, 0}}); tile_3_2_0_0->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, Found}, // RetainTileDataAction{{3, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -886,13 +756,8 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { log.clear(); source.idealTiles.clear(); source.idealTiles.emplace(OverscaledTileID{2, 0, 0}); - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, Found}, // RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -906,13 +771,8 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { tile_2_2_0_0 = nullptr; // Use the overzoomed tile even though it doesn't match the zoom level. - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, NotFound}, // CreateTileDataAction{{2, 0, {2, 0, 0}}}, // @@ -938,13 +798,8 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) { // Add a matching overzoomed tile and make sure it gets selected. auto tile_3_2_0_0 = source.createTileData(OverscaledTileID{3, 0, {2, 0, 0}}); tile_3_2_0_0->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, Found}, // RetainTileDataAction{{3, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -958,13 +813,8 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) { tile_3_2_0_0 = nullptr; auto tile_2_2_0_0 = source.createTileData(OverscaledTileID{2, 0, {2, 0, 0}}); tile_2_2_0_0->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, NotFound}, // CreateTileDataAction{{3, 0, {2, 0, 0}}}, // @@ -982,13 +832,8 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) { tile_2_2_0_0 = nullptr; auto tile_1_1_0_0 = source.createTileData(OverscaledTileID{1, 0, {1, 0, 0}}); tile_1_1_0_0->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{3, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -1003,13 +848,8 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) { // Now, mark the created tile as found. log.clear(); source.dataTiles[{3, 0, {2, 0, 0}}]->triedOptional = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{3, 0, {2, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{3, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -1035,13 +875,8 @@ TEST(UpdateRenderables, DoNotAscendMultipleTimesIfNotFound) { source.idealTiles.emplace(OverscaledTileID{8, 0, 0}); source.idealTiles.emplace(OverscaledTileID{8, 1, 0}); - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{8, 0, {8, 0, 0}}, NotFound}, // ideal tile CreateTileDataAction{{8, 0, {8, 0, 0}}}, // @@ -1075,13 +910,8 @@ TEST(UpdateRenderables, DoNotAscendMultipleTimesIfNotFound) { auto tile_4_0_0_0 = source.createTileData(OverscaledTileID{4, 0, {4, 0, 0}}); tile_4_0_0_0->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{8, 0, {8, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{8, 0, {8, 0, 0}}, TileNecessity::Required}, // @@ -1120,13 +950,8 @@ TEST(UpdateRenderables, DontRetainUnusedNonIdealTiles) { source.createTileData(OverscaledTileID{1, 0, 0}); source.createTileData(OverscaledTileID{2, 0, 0}); - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{2, 0, {2, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Required}, // @@ -1163,13 +988,8 @@ TEST(UpdateRenderables, WrappedTiles) { auto tile_0_0_0_0 = source.createTileData(OverscaledTileID{0, 0, {0, 0, 0}}); tile_0_0_0_0->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ( ActionLog({ GetTileDataAction{{1, -1, {1, 1, 0}}, NotFound}, // ideal tile 1/-1/0 (wrapped to -1) @@ -1223,13 +1043,8 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { source.idealTiles.emplace(OverscaledTileID{6, 0, 0}); - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, NotFound}, // ideal tile, not found CreateTileDataAction{{6, 0, {6, 0, 0}}}, // @@ -1249,13 +1064,8 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { // Repeat. log.clear(); - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1275,13 +1085,8 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { // Mark next level has having tried optional. log.clear(); source.dataTiles[{6, 0, {6, 0, 0}}]->triedOptional = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1302,13 +1107,8 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { // Repeat. log.clear(); - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1329,13 +1129,8 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { // Mark next level has having tried optional. log.clear(); source.dataTiles[{5, 0, {5, 0, 0}}]->triedOptional = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1358,13 +1153,8 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { // Mark next level has having tried optional. log.clear(); source.dataTiles[{4, 0, {4, 0, 0}}]->triedOptional = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1388,13 +1178,8 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { // Mark next level has having tried optional. log.clear(); source.dataTiles[{3, 0, {3, 0, 0}}]->triedOptional = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1420,13 +1205,8 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { log.clear(); auto tile_3_3_0_0 = source.dataTiles[{3, 0, {3, 0, 0}}].get(); tile_3_3_0_0->renderable = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not ready RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1460,13 +1240,8 @@ TEST(UpdateRenderables, LoadRequiredIfIdealTileCantBeFound) { tile_6_6_0_0->triedOptional = true; tile_6_6_0_0->loaded = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{6, 0, {6, 0, 0}}, Found}, // ideal tile, not found RetainTileDataAction{{6, 0, {6, 0, 0}}, TileNecessity::Required}, // @@ -1516,13 +1291,8 @@ TEST(UpdateRenderables, LoadOverscaledMaxZoomTile) { tile_1_1_0_0->triedOptional = true; tile_1_1_0_0->loaded = true; - algorithm::updateRenderables(getTileData, - createTileData, - retainTileData, - renderTile, - source.idealTiles, - source.dataTiles, - source.zoomRange); + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ GetTileDataAction{{4, 0, {2, 0, 0}}, Found}, RetainTileDataAction{{4, 0, {2, 0, 0}}, TileNecessity::Required}, From 83ae58664dd7a6fbebd23dca9b71c68add87aabd Mon Sep 17 00:00:00 2001 From: Alex Cristici Date: Thu, 1 Aug 2024 10:37:02 +0300 Subject: [PATCH 09/19] Removed unnecessary fix. --- src/mbgl/renderer/tile_pyramid.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/mbgl/renderer/tile_pyramid.cpp b/src/mbgl/renderer/tile_pyramid.cpp index 5b6cbe77630..0382395ca48 100644 --- a/src/mbgl/renderer/tile_pyramid.cpp +++ b/src/mbgl/renderer/tile_pyramid.cpp @@ -122,8 +122,6 @@ void TilePyramid::update(const std::vector>& l if (panZoom < idealZoom) { panTiles = util::tileCover(parameters.transformState, panZoom); - } else { - panTiles = util::tileCover(parameters.transformState, idealZoom, panZoom); } } From 81c3d590d03ba6a90c7750d4b2d549a6092b71f9 Mon Sep 17 00:00:00 2001 From: Alex Cristici Date: Fri, 2 Aug 2024 13:40:16 +0300 Subject: [PATCH 10/19] Units tests fixed. --- src/mbgl/algorithm/update_renderables.hpp | 23 ++++++++++++----------- src/mbgl/renderer/tile_pyramid.cpp | 3 ++- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/mbgl/algorithm/update_renderables.hpp b/src/mbgl/algorithm/update_renderables.hpp index 236423671ef..8387c927374 100644 --- a/src/mbgl/algorithm/update_renderables.hpp +++ b/src/mbgl/algorithm/update_renderables.hpp @@ -15,13 +15,13 @@ template + typename PrefetchedTileMap> void updateRenderables(GetTileFn getTile, CreateTileFn createTile, RetainTileFn retainTile, RenderTileFn renderTile, const IdealTileIDs& idealTileIDs, - const std::map>& prefetchedTiles, + const PrefetchedTileMap& prefetchedTiles, const Range& zoomRange, const std::optional& maxParentOverscaleFactor = std::nullopt) { std::unordered_set checked; @@ -57,14 +57,15 @@ void updateRenderables(GetTileFn getTile, // The tile isn't loaded yet, but retain it anyway because it's an ideal tile. retainTile(*tile, TileNecessity::Required); - auto addPrefetchedTilesIfChildrenOf = [&](const UnwrappedTileID& tileID) { - for (auto& prefetchedTileIt : prefetchedTiles) { - const UnwrappedTileID prefetchedTileID = prefetchedTileIt.first.toUnwrapped(); - TileData* prefetchedTile = prefetchedTileIt.second.get(); - if (prefetchedTile->isRenderable() && - (prefetchedTileID == tileID || prefetchedTileID.isChildOf(tileID))) { + auto addPrefetchedTilesIfChildrenOf = [&](const OverscaledTileID& tileID) { + for (auto& prefetchedTileEntry : prefetchedTiles) { + const auto& prefetchedDataTileID = prefetchedTileEntry.first; + const UnwrappedTileID prefetchedRenderTileID = prefetchedDataTileID.toUnwrapped(); + auto* prefetchedTile = prefetchedTileEntry.second.get(); + if (prefetchedTile->isRenderable() && prefetchedDataTileID.canonical.z <= zoomRange.max && + prefetchedDataTileID.isChildOf(tileID)) { retainTile(*prefetchedTile, TileNecessity::Optional); - renderTile(prefetchedTileID, *prefetchedTile); + renderTile(prefetchedRenderTileID, *prefetchedTile); } } }; @@ -82,7 +83,7 @@ void updateRenderables(GetTileFn getTile, covered = false; // Reuse prefetched tiles in order to avoid empty screen - addPrefetchedTilesIfChildrenOf(idealRenderTileID); + addPrefetchedTilesIfChildrenOf(idealDataTileID); } } else { // Check all four actual child tiles. @@ -98,7 +99,7 @@ void updateRenderables(GetTileFn getTile, covered = false; // Reuse prefetched tiles in order to avoid empty screen - addPrefetchedTilesIfChildrenOf(childDataTileID.toUnwrapped()); + addPrefetchedTilesIfChildrenOf(childDataTileID); } } } diff --git a/src/mbgl/renderer/tile_pyramid.cpp b/src/mbgl/renderer/tile_pyramid.cpp index 0382395ca48..cc941ad4ad0 100644 --- a/src/mbgl/renderer/tile_pyramid.cpp +++ b/src/mbgl/renderer/tile_pyramid.cpp @@ -23,6 +23,7 @@ namespace mbgl { using namespace style; static TileObserver nullObserver; +static std::map> emptyPrefetchedTiles; TilePyramid::TilePyramid(const TaggedScheduler& threadPool_) : cache(threadPool_), @@ -197,7 +198,7 @@ void TilePyramid::update(const std::vector>& l retainTileFn, [](const UnwrappedTileID&, Tile&) {}, panTiles, - tiles, + emptyPrefetchedTiles, zoomRange, maxParentTileOverscaleFactor); } From 3b5b0c6edb0674f4d982fab08759b0e1d49de1f6 Mon Sep 17 00:00:00 2001 From: Alex Cristici Date: Fri, 2 Aug 2024 14:10:26 +0300 Subject: [PATCH 11/19] Added unit test. --- test/algorithm/update_renderables.test.cpp | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/algorithm/update_renderables.test.cpp b/test/algorithm/update_renderables.test.cpp index a74a7c54195..0fab64d9ce4 100644 --- a/test/algorithm/update_renderables.test.cpp +++ b/test/algorithm/update_renderables.test.cpp @@ -485,6 +485,32 @@ TEST(UpdateRenderables, UseChildTiles) { // no parent tile of 0 to consider }), log); + + // Remove direct children and add children 2 zoom levels down + log.clear(); + source.dataTiles.erase(OverscaledTileID{1, 0, 0}); + source.dataTiles.erase(OverscaledTileID{1, 1, 0}); + auto tile_2_2_0_0 = source.createTileData(OverscaledTileID{2, 0, 0}); + tile_2_2_0_0->renderable = true; + auto tile_2_2_1_0 = source.createTileData(OverscaledTileID{2, 1, 0}); + tile_2_2_1_0->renderable = true; + + algorithm::updateRenderables( + getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); + EXPECT_EQ(ActionLog({ + GetTileDataAction{{0, 0, {0, 0, 0}}, Found}, // ideal tile not ready + RetainTileDataAction{{0, 0, {0, 0, 0}}, TileNecessity::Required}, // + GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // child tile not found + RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Optional}, + RenderTileAction{{2, 0, 0}, *tile_2_2_0_0}, // render child from 2 levels down + RetainTileDataAction{{2, 0, {2, 1, 0}}, TileNecessity::Optional}, + RenderTileAction{{2, 1, 0}, *tile_2_2_1_0}, // render child from 2 levels down + GetTileDataAction{{1, 0, {1, 0, 1}}, NotFound}, // child tile not found + GetTileDataAction{{1, 0, {1, 1, 0}}, NotFound}, // child tile not found + GetTileDataAction{{1, 0, {1, 1, 1}}, NotFound}, // child tile not found + // no parent tile of 0 to consider + }), + log); } TEST(UpdateRenderables, PreferChildTiles) { From e11c912d45be85c4aff25b78d9bee8332135b42b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 2 Aug 2024 11:13:01 +0000 Subject: [PATCH 12/19] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- test/algorithm/update_renderables.test.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/algorithm/update_renderables.test.cpp b/test/algorithm/update_renderables.test.cpp index 0fab64d9ce4..5a3a365a0ee 100644 --- a/test/algorithm/update_renderables.test.cpp +++ b/test/algorithm/update_renderables.test.cpp @@ -485,7 +485,7 @@ TEST(UpdateRenderables, UseChildTiles) { // no parent tile of 0 to consider }), log); - + // Remove direct children and add children 2 zoom levels down log.clear(); source.dataTiles.erase(OverscaledTileID{1, 0, 0}); @@ -494,7 +494,7 @@ TEST(UpdateRenderables, UseChildTiles) { tile_2_2_0_0->renderable = true; auto tile_2_2_1_0 = source.createTileData(OverscaledTileID{2, 1, 0}); tile_2_2_1_0->renderable = true; - + algorithm::updateRenderables( getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); EXPECT_EQ(ActionLog({ @@ -502,13 +502,13 @@ TEST(UpdateRenderables, UseChildTiles) { RetainTileDataAction{{0, 0, {0, 0, 0}}, TileNecessity::Required}, // GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // child tile not found RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Optional}, - RenderTileAction{{2, 0, 0}, *tile_2_2_0_0}, // render child from 2 levels down + RenderTileAction{{2, 0, 0}, *tile_2_2_0_0}, // render child from 2 levels down RetainTileDataAction{{2, 0, {2, 1, 0}}, TileNecessity::Optional}, - RenderTileAction{{2, 1, 0}, *tile_2_2_1_0}, // render child from 2 levels down - GetTileDataAction{{1, 0, {1, 0, 1}}, NotFound}, // child tile not found - GetTileDataAction{{1, 0, {1, 1, 0}}, NotFound}, // child tile not found - GetTileDataAction{{1, 0, {1, 1, 1}}, NotFound}, // child tile not found - // no parent tile of 0 to consider + RenderTileAction{{2, 1, 0}, *tile_2_2_1_0}, // render child from 2 levels down + GetTileDataAction{{1, 0, {1, 0, 1}}, NotFound}, // child tile not found + GetTileDataAction{{1, 0, {1, 1, 0}}, NotFound}, // child tile not found + GetTileDataAction{{1, 0, {1, 1, 1}}, NotFound}, // child tile not found + // no parent tile of 0 to consider }), log); } From e51f373956dfeecfe5d14ddeba4a1715b88c709e Mon Sep 17 00:00:00 2001 From: Alex Cristici Date: Fri, 2 Aug 2024 19:48:26 +0300 Subject: [PATCH 13/19] Fixed zoom out issue that keeps the childern too long instead using parent tile. --- src/mbgl/algorithm/update_renderables.hpp | 39 +++++++++++----------- test/algorithm/update_renderables.test.cpp | 13 ++++---- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/mbgl/algorithm/update_renderables.hpp b/src/mbgl/algorithm/update_renderables.hpp index 8387c927374..f50a844c284 100644 --- a/src/mbgl/algorithm/update_renderables.hpp +++ b/src/mbgl/algorithm/update_renderables.hpp @@ -26,6 +26,7 @@ void updateRenderables(GetTileFn getTile, const std::optional& maxParentOverscaleFactor = std::nullopt) { std::unordered_set checked; bool covered; + bool parentOrChildTileFound; int32_t overscaledZ; // for (all in the set of ideal tiles of the source) { @@ -56,21 +57,8 @@ void updateRenderables(GetTileFn getTile, // The tile isn't loaded yet, but retain it anyway because it's an ideal tile. retainTile(*tile, TileNecessity::Required); - - auto addPrefetchedTilesIfChildrenOf = [&](const OverscaledTileID& tileID) { - for (auto& prefetchedTileEntry : prefetchedTiles) { - const auto& prefetchedDataTileID = prefetchedTileEntry.first; - const UnwrappedTileID prefetchedRenderTileID = prefetchedDataTileID.toUnwrapped(); - auto* prefetchedTile = prefetchedTileEntry.second.get(); - if (prefetchedTile->isRenderable() && prefetchedDataTileID.canonical.z <= zoomRange.max && - prefetchedDataTileID.isChildOf(tileID)) { - retainTile(*prefetchedTile, TileNecessity::Optional); - renderTile(prefetchedRenderTileID, *prefetchedTile); - } - } - }; - covered = true; + parentOrChildTileFound = false; overscaledZ = idealDataTileID.overscaledZ + 1; if (overscaledZ > zoomRange.max) { // We're looking for an overzoomed child tile. @@ -79,11 +67,9 @@ void updateRenderables(GetTileFn getTile, if (tile && tile->isRenderable()) { retainTile(*tile, TileNecessity::Optional); renderTile(idealRenderTileID, *tile); + parentOrChildTileFound = true; } else { covered = false; - - // Reuse prefetched tiles in order to avoid empty screen - addPrefetchedTilesIfChildrenOf(idealDataTileID); } } else { // Check all four actual child tiles. @@ -93,13 +79,11 @@ void updateRenderables(GetTileFn getTile, if (tile && tile->isRenderable()) { retainTile(*tile, TileNecessity::Optional); renderTile(childDataTileID.toUnwrapped(), *tile); + parentOrChildTileFound = true; } else { // At least one child tile doesn't exist, so we are // going to look for parents as well. covered = false; - - // Reuse prefetched tiles in order to avoid empty screen - addPrefetchedTilesIfChildrenOf(childDataTileID); } } } @@ -149,11 +133,26 @@ void updateRenderables(GetTileFn getTile, if (tile->isRenderable()) { renderTile(parentDataTileID.toUnwrapped(), *tile); + parentOrChildTileFound = true; // Break parent tile ascent, since we found one. break; } } } + + if (!parentOrChildTileFound) { + // Reuse prefetched tiles in order to avoid empty screen + for (auto& prefetchedTileEntry : prefetchedTiles) { + const auto& prefetchedDataTileID = prefetchedTileEntry.first; + const UnwrappedTileID prefetchedRenderTileID = prefetchedDataTileID.toUnwrapped(); + auto* prefetchedTile = prefetchedTileEntry.second.get(); + if (prefetchedTile->isRenderable() && prefetchedDataTileID.canonical.z <= zoomRange.max && + prefetchedDataTileID.isChildOf(idealDataTileID)) { + retainTile(*prefetchedTile, TileNecessity::Optional); + renderTile(prefetchedRenderTileID, *prefetchedTile); + } + } + } } } } diff --git a/test/algorithm/update_renderables.test.cpp b/test/algorithm/update_renderables.test.cpp index 5a3a365a0ee..0ba829fc61f 100644 --- a/test/algorithm/update_renderables.test.cpp +++ b/test/algorithm/update_renderables.test.cpp @@ -501,14 +501,15 @@ TEST(UpdateRenderables, UseChildTiles) { GetTileDataAction{{0, 0, {0, 0, 0}}, Found}, // ideal tile not ready RetainTileDataAction{{0, 0, {0, 0, 0}}, TileNecessity::Required}, // GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // child tile not found + GetTileDataAction{{1, 0, {1, 0, 1}}, NotFound}, // child tile not found + GetTileDataAction{{1, 0, {1, 1, 0}}, NotFound}, // child tile not found + GetTileDataAction{{1, 0, {1, 1, 1}}, NotFound}, // child tile not found + // no parent tile of 0 to consider + // no parent or child tile found, check prefetched tiles RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Optional}, - RenderTileAction{{2, 0, 0}, *tile_2_2_0_0}, // render child from 2 levels down + RenderTileAction{{2, 0, 0}, *tile_2_2_0_0}, // render child from 2 levels down RetainTileDataAction{{2, 0, {2, 1, 0}}, TileNecessity::Optional}, - RenderTileAction{{2, 1, 0}, *tile_2_2_1_0}, // render child from 2 levels down - GetTileDataAction{{1, 0, {1, 0, 1}}, NotFound}, // child tile not found - GetTileDataAction{{1, 0, {1, 1, 0}}, NotFound}, // child tile not found - GetTileDataAction{{1, 0, {1, 1, 1}}, NotFound}, // child tile not found - // no parent tile of 0 to consider + RenderTileAction{{2, 1, 0}, *tile_2_2_1_0}, // render child from 2 levels down }), log); } From 181704ca85b53fd3412187e31c615ae178cc69ce Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 2 Aug 2024 16:51:31 +0000 Subject: [PATCH 14/19] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/mbgl/algorithm/update_renderables.hpp | 2 +- test/algorithm/update_renderables.test.cpp | 31 +++++++++++----------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/mbgl/algorithm/update_renderables.hpp b/src/mbgl/algorithm/update_renderables.hpp index f50a844c284..117ad2f1acc 100644 --- a/src/mbgl/algorithm/update_renderables.hpp +++ b/src/mbgl/algorithm/update_renderables.hpp @@ -139,7 +139,7 @@ void updateRenderables(GetTileFn getTile, } } } - + if (!parentOrChildTileFound) { // Reuse prefetched tiles in order to avoid empty screen for (auto& prefetchedTileEntry : prefetchedTiles) { diff --git a/test/algorithm/update_renderables.test.cpp b/test/algorithm/update_renderables.test.cpp index 0ba829fc61f..b9b245c8f5f 100644 --- a/test/algorithm/update_renderables.test.cpp +++ b/test/algorithm/update_renderables.test.cpp @@ -497,21 +497,22 @@ TEST(UpdateRenderables, UseChildTiles) { algorithm::updateRenderables( getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); - EXPECT_EQ(ActionLog({ - GetTileDataAction{{0, 0, {0, 0, 0}}, Found}, // ideal tile not ready - RetainTileDataAction{{0, 0, {0, 0, 0}}, TileNecessity::Required}, // - GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // child tile not found - GetTileDataAction{{1, 0, {1, 0, 1}}, NotFound}, // child tile not found - GetTileDataAction{{1, 0, {1, 1, 0}}, NotFound}, // child tile not found - GetTileDataAction{{1, 0, {1, 1, 1}}, NotFound}, // child tile not found - // no parent tile of 0 to consider - // no parent or child tile found, check prefetched tiles - RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Optional}, - RenderTileAction{{2, 0, 0}, *tile_2_2_0_0}, // render child from 2 levels down - RetainTileDataAction{{2, 0, {2, 1, 0}}, TileNecessity::Optional}, - RenderTileAction{{2, 1, 0}, *tile_2_2_1_0}, // render child from 2 levels down - }), - log); + EXPECT_EQ( + ActionLog({ + GetTileDataAction{{0, 0, {0, 0, 0}}, Found}, // ideal tile not ready + RetainTileDataAction{{0, 0, {0, 0, 0}}, TileNecessity::Required}, // + GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // child tile not found + GetTileDataAction{{1, 0, {1, 0, 1}}, NotFound}, // child tile not found + GetTileDataAction{{1, 0, {1, 1, 0}}, NotFound}, // child tile not found + GetTileDataAction{{1, 0, {1, 1, 1}}, NotFound}, // child tile not found + // no parent tile of 0 to consider + // no parent or child tile found, check prefetched tiles + RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Optional}, + RenderTileAction{{2, 0, 0}, *tile_2_2_0_0}, // render child from 2 levels down + RetainTileDataAction{{2, 0, {2, 1, 0}}, TileNecessity::Optional}, + RenderTileAction{{2, 1, 0}, *tile_2_2_1_0}, // render child from 2 levels down + }), + log); } TEST(UpdateRenderables, PreferChildTiles) { From a9f62230bea9f4ec5addcb77a11ccf42ee3d8e4c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 2 Aug 2024 18:00:56 +0000 Subject: [PATCH 15/19] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- test/algorithm/update_renderables.test.cpp | 31 +++++++++++----------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/test/algorithm/update_renderables.test.cpp b/test/algorithm/update_renderables.test.cpp index b9b245c8f5f..773975fea5d 100644 --- a/test/algorithm/update_renderables.test.cpp +++ b/test/algorithm/update_renderables.test.cpp @@ -497,22 +497,21 @@ TEST(UpdateRenderables, UseChildTiles) { algorithm::updateRenderables( getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); - EXPECT_EQ( - ActionLog({ - GetTileDataAction{{0, 0, {0, 0, 0}}, Found}, // ideal tile not ready - RetainTileDataAction{{0, 0, {0, 0, 0}}, TileNecessity::Required}, // - GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // child tile not found - GetTileDataAction{{1, 0, {1, 0, 1}}, NotFound}, // child tile not found - GetTileDataAction{{1, 0, {1, 1, 0}}, NotFound}, // child tile not found - GetTileDataAction{{1, 0, {1, 1, 1}}, NotFound}, // child tile not found - // no parent tile of 0 to consider - // no parent or child tile found, check prefetched tiles - RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Optional}, - RenderTileAction{{2, 0, 0}, *tile_2_2_0_0}, // render child from 2 levels down - RetainTileDataAction{{2, 0, {2, 1, 0}}, TileNecessity::Optional}, - RenderTileAction{{2, 1, 0}, *tile_2_2_1_0}, // render child from 2 levels down - }), - log); + EXPECT_EQ(ActionLog({ + GetTileDataAction{{0, 0, {0, 0, 0}}, Found}, // ideal tile not ready + RetainTileDataAction{{0, 0, {0, 0, 0}}, TileNecessity::Required}, // + GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // child tile not found + GetTileDataAction{{1, 0, {1, 0, 1}}, NotFound}, // child tile not found + GetTileDataAction{{1, 0, {1, 1, 0}}, NotFound}, // child tile not found + GetTileDataAction{{1, 0, {1, 1, 1}}, NotFound}, // child tile not found + // no parent tile of 0 to consider + // no parent or child tile found, check prefetched tiles + RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Optional}, + RenderTileAction{{2, 0, 0}, *tile_2_2_0_0}, // render child from 2 levels down + RetainTileDataAction{{2, 0, {2, 1, 0}}, TileNecessity::Optional}, + RenderTileAction{{2, 1, 0}, *tile_2_2_1_0}, // render child from 2 levels down + }), + log); } TEST(UpdateRenderables, PreferChildTiles) { From 3ed6303648940616a92c663724fc51d6cfcad887 Mon Sep 17 00:00:00 2001 From: Alex Cristici Date: Fri, 2 Aug 2024 21:02:38 +0300 Subject: [PATCH 16/19] Fix comments. --- test/algorithm/update_renderables.test.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/algorithm/update_renderables.test.cpp b/test/algorithm/update_renderables.test.cpp index 773975fea5d..1bd19b1b8b9 100644 --- a/test/algorithm/update_renderables.test.cpp +++ b/test/algorithm/update_renderables.test.cpp @@ -505,11 +505,11 @@ TEST(UpdateRenderables, UseChildTiles) { GetTileDataAction{{1, 0, {1, 1, 0}}, NotFound}, // child tile not found GetTileDataAction{{1, 0, {1, 1, 1}}, NotFound}, // child tile not found // no parent tile of 0 to consider - // no parent or child tile found, check prefetched tiles - RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Optional}, - RenderTileAction{{2, 0, 0}, *tile_2_2_0_0}, // render child from 2 levels down - RetainTileDataAction{{2, 0, {2, 1, 0}}, TileNecessity::Optional}, - RenderTileAction{{2, 1, 0}, *tile_2_2_1_0}, // render child from 2 levels down + // no parent or child tile found, check prefetched tiles + RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Optional}, // + RenderTileAction{{2, 0, 0}, *tile_2_2_0_0}, // render child from 2 levels down + RetainTileDataAction{{2, 0, {2, 1, 0}}, TileNecessity::Optional}, // + RenderTileAction{{2, 1, 0}, *tile_2_2_1_0}, // render child from 2 levels down }), log); } From 0a57a3c49f43d9f8b7fcffcd386089dfc3b5a40a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 2 Aug 2024 18:04:31 +0000 Subject: [PATCH 17/19] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- test/algorithm/update_renderables.test.cpp | 31 +++++++++++----------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/test/algorithm/update_renderables.test.cpp b/test/algorithm/update_renderables.test.cpp index 1bd19b1b8b9..14c008d46d6 100644 --- a/test/algorithm/update_renderables.test.cpp +++ b/test/algorithm/update_renderables.test.cpp @@ -497,21 +497,22 @@ TEST(UpdateRenderables, UseChildTiles) { algorithm::updateRenderables( getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); - EXPECT_EQ(ActionLog({ - GetTileDataAction{{0, 0, {0, 0, 0}}, Found}, // ideal tile not ready - RetainTileDataAction{{0, 0, {0, 0, 0}}, TileNecessity::Required}, // - GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // child tile not found - GetTileDataAction{{1, 0, {1, 0, 1}}, NotFound}, // child tile not found - GetTileDataAction{{1, 0, {1, 1, 0}}, NotFound}, // child tile not found - GetTileDataAction{{1, 0, {1, 1, 1}}, NotFound}, // child tile not found - // no parent tile of 0 to consider - // no parent or child tile found, check prefetched tiles - RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Optional}, // - RenderTileAction{{2, 0, 0}, *tile_2_2_0_0}, // render child from 2 levels down - RetainTileDataAction{{2, 0, {2, 1, 0}}, TileNecessity::Optional}, // - RenderTileAction{{2, 1, 0}, *tile_2_2_1_0}, // render child from 2 levels down - }), - log); + EXPECT_EQ( + ActionLog({ + GetTileDataAction{{0, 0, {0, 0, 0}}, Found}, // ideal tile not ready + RetainTileDataAction{{0, 0, {0, 0, 0}}, TileNecessity::Required}, // + GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // child tile not found + GetTileDataAction{{1, 0, {1, 0, 1}}, NotFound}, // child tile not found + GetTileDataAction{{1, 0, {1, 1, 0}}, NotFound}, // child tile not found + GetTileDataAction{{1, 0, {1, 1, 1}}, NotFound}, // child tile not found + // no parent tile of 0 to consider + // no parent or child tile found, check prefetched tiles + RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Optional}, // + RenderTileAction{{2, 0, 0}, *tile_2_2_0_0}, // render child from 2 levels down + RetainTileDataAction{{2, 0, {2, 1, 0}}, TileNecessity::Optional}, // + RenderTileAction{{2, 1, 0}, *tile_2_2_1_0}, // render child from 2 levels down + }), + log); } TEST(UpdateRenderables, PreferChildTiles) { From 79d4a9dda5adbe05056d321bbd28ff0ee7c66f33 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Fri, 2 Aug 2024 20:32:47 +0200 Subject: [PATCH 18/19] manual run clang-format --- test/algorithm/update_renderables.test.cpp | 31 +++++++++++----------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/test/algorithm/update_renderables.test.cpp b/test/algorithm/update_renderables.test.cpp index 14c008d46d6..ea6499248e6 100644 --- a/test/algorithm/update_renderables.test.cpp +++ b/test/algorithm/update_renderables.test.cpp @@ -497,22 +497,21 @@ TEST(UpdateRenderables, UseChildTiles) { algorithm::updateRenderables( getTileData, createTileData, retainTileData, renderTile, source.idealTiles, source.dataTiles, source.zoomRange); - EXPECT_EQ( - ActionLog({ - GetTileDataAction{{0, 0, {0, 0, 0}}, Found}, // ideal tile not ready - RetainTileDataAction{{0, 0, {0, 0, 0}}, TileNecessity::Required}, // - GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // child tile not found - GetTileDataAction{{1, 0, {1, 0, 1}}, NotFound}, // child tile not found - GetTileDataAction{{1, 0, {1, 1, 0}}, NotFound}, // child tile not found - GetTileDataAction{{1, 0, {1, 1, 1}}, NotFound}, // child tile not found - // no parent tile of 0 to consider - // no parent or child tile found, check prefetched tiles - RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Optional}, // - RenderTileAction{{2, 0, 0}, *tile_2_2_0_0}, // render child from 2 levels down - RetainTileDataAction{{2, 0, {2, 1, 0}}, TileNecessity::Optional}, // - RenderTileAction{{2, 1, 0}, *tile_2_2_1_0}, // render child from 2 levels down - }), - log); + EXPECT_EQ(ActionLog({ + GetTileDataAction{{0, 0, {0, 0, 0}}, Found}, // ideal tile not ready + RetainTileDataAction{{0, 0, {0, 0, 0}}, TileNecessity::Required}, // + GetTileDataAction{{1, 0, {1, 0, 0}}, NotFound}, // child tile not found + GetTileDataAction{{1, 0, {1, 0, 1}}, NotFound}, // child tile not found + GetTileDataAction{{1, 0, {1, 1, 0}}, NotFound}, // child tile not found + GetTileDataAction{{1, 0, {1, 1, 1}}, NotFound}, // child tile not found + // no parent tile of 0 to consider + // no parent or child tile found, check prefetched tiles + RetainTileDataAction{{2, 0, {2, 0, 0}}, TileNecessity::Optional}, // + RenderTileAction{{2, 0, 0}, *tile_2_2_0_0}, // render child from 2 levels down + RetainTileDataAction{{2, 0, {2, 1, 0}}, TileNecessity::Optional}, // + RenderTileAction{{2, 1, 0}, *tile_2_2_1_0}, // render child from 2 levels down + }), + log); } TEST(UpdateRenderables, PreferChildTiles) { From 889c36f531d7e7337cb3e2b6ab509f3f50a39e75 Mon Sep 17 00:00:00 2001 From: Alex Cristici Date: Wed, 7 Aug 2024 18:02:13 +0300 Subject: [PATCH 19/19] Fixed variable initialization. --- src/mbgl/algorithm/update_renderables.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mbgl/algorithm/update_renderables.hpp b/src/mbgl/algorithm/update_renderables.hpp index 117ad2f1acc..6b3cb457406 100644 --- a/src/mbgl/algorithm/update_renderables.hpp +++ b/src/mbgl/algorithm/update_renderables.hpp @@ -25,9 +25,9 @@ void updateRenderables(GetTileFn getTile, const Range& zoomRange, const std::optional& maxParentOverscaleFactor = std::nullopt) { std::unordered_set checked; - bool covered; - bool parentOrChildTileFound; - int32_t overscaledZ; + bool covered = false; + bool parentOrChildTileFound = false; + int32_t overscaledZ = 0; // for (all in the set of ideal tiles of the source) { for (const auto& idealDataTileID : idealTileIDs) {