Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[core] Tile prefetching no longer works #11213

Closed
tmpsantos opened this issue Feb 15, 2018 · 3 comments · Fixed by #11227
Closed

[core] Tile prefetching no longer works #11213

tmpsantos opened this issue Feb 15, 2018 · 3 comments · Fixed by #11227
Assignees
Labels
bug Core The cross-platform C++ core, aka mbgl
Milestone

Comments

@tmpsantos
Copy link
Contributor

tmpsantos commented Feb 15, 2018

Tile prefetch (prefetching and rendering lower resolution tiles until we get tiles for the current zoom level, avoiding blank spots on the map) is no longer working. I bisect the regression to 10a4405.

This is probably why the Map.PrefetchTiles is failing. Sadly seems like the test doesn't always fail, so it would have detected the regression when it was introduced (my bad).

It is easy to reproduce and inspect visually, as one commit before the regression we see that lower resolution tiles are loaded first:

Mapbox GL at 10a4405:
prefetch_working

Mapbox GL at bfa4cea:
prefetch_working2

/cc @asheemmamoowala @Guardiola31337 @kkaefer

@ChrisLoer
Copy link
Contributor

@ChrisLoer ChrisLoer reopened this Feb 26, 2018
@asheemmamoowala
Copy link
Contributor

I debugged the Map.PrefetchTiles test, and don't see it hitting any of the code introduced in 10a4405.

I'm seeing a few issues:

  1. Map.PrefetchTiles sets the map mode to Static, but TilePyramid's prefetch-ing is conditional on map mode being Continuous. [core] Allow prefetching tiles for all source types #10548 added the check in TilePyramid. This test should not have passed since that change.

  2. The std::is_permutation check seems to be passing even when it shouldn't. According to the docs:

Returns true if there exists a permutation of the elements in the range [first1, last1) that makes that range equal to the range [first2,last2), where last2 denotes first2 + (last1 - first1) if it was not given.

ASSERT_TRUE(std::is_permutation(tiles.begin(), tiles.end(), expected.begin()));

In the cases where a parent tile should be prefetched, expected.size() > tiles.size(). It turns out that the permutation test matches because the expected parent zoom is always the last value in expected, and isn't being considered in the permutation check.

A naive fix for #2 is to move the parent tile zoom value to the beginning of the expected vector. With this change, the test passed before #10548 merged, and consistently fails after.

@asheemmamoowala
Copy link
Contributor

Moving to -> #11326

@friedbunny friedbunny added bug Core The cross-platform C++ core, aka mbgl labels Mar 8, 2018
@friedbunny friedbunny added this to the ios-v3.7.6 milestone Mar 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Core The cross-platform C++ core, aka mbgl
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants