Skip to content

feat(geo-layers): coverage LOD tile prefetching (1/2) - #10306

Open
charlieforward9 wants to merge 4 commits into
masterfrom
codex/tile-priority-on-master-demo
Open

charlieforward9 wants to merge 4 commits into
masterfrom
codex/tile-priority-on-master-demo

Conversation

@charlieforward9

@charlieforward9 charlieforward9 commented May 15, 2026 •

Copy link
Copy Markdown
Member

Follow up of #10364. Part 1 of 2; pacing of hidden tiles follows in #11175.

During fast camera moves, high-zoom requests fill the queue and leave blank areas until they load. With the opt-in lodStrategy: 'coverage', each view also requests the parent and a coarse ancestor of its selected tiles, which stay on screen until sharper tiles arrive.

lod_strategy_comparison.mov

Change List

  • Tileset2D: opt-in lodStrategy; default 'none' is unchanged
    • Coverage requested after selected and visible tiles
    • Not aborted while needed; evicted after stale tiles
    • Computed per Tile2DView, unioned across consumers
  • Globes: coverage floor at zoom 6, fallback at zoom 4
  • best-available: show loaded descendants above coverage ancestors
  • lodStrategy on TileLayer, TerrainLayer and Tile2DLayer
  • lod-strategy-demo test app: before/after comparison
  • Unit tests
  • Documentation and What's New

Verified with the geo-layers unit tests and the terrain, MVT and bitmap render tests.

@charlieforward9 charlieforward9 self-assigned this May 15, 2026
@charlieforward9
charlieforward9 marked this pull request as ready for review May 15, 2026 18:08
@charlieforward9
charlieforward9 requested a review from ibgreen May 15, 2026 18:09
@coveralls

coveralls commented May 15, 2026 •

Copy link
Copy Markdown

Coverage Status

Coverage is 84.234% — codex/tile-priority-on-master-demo into cr/fix-globe-mercator-tiles. No base build found for cr/fix-globe-mercator-tiles.

@charlieforward9
charlieforward9 requested a review from akre54 May 15, 2026 23:47
@charlieforward9 charlieforward9 changed the title Prioritize tile requests near viewport center Add coverage LOD tile prefetching May 16, 2026

@chrisgervang chrisgervang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a couple of interesting things in the demo that I'm not really sure how to improve:

  1. As the low-resolution tiles are loading in and the high-resolution tiles are loading on top, I can see almost like a parallax or perspective shift between the low-res and high-res tiles. I'm curious what the root cause of that is.
  2. I see a lot of z-fighting as we zoom into the final destination in New York between the low-res and high-res tiles. There's a lot of z-fighting in the before as well, so this isn't a regression and more a limitation with our renderer

I wrote a draft of docs for this that I'll push up for you to review.

Comment thread test/apps/lod-strategy-demo/app.tsx Resolved

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4be9e53. Configure here.

@charlieforward9

Copy link
Copy Markdown
Member Author

@chrisgervang

I can see almost like a parallax or perspective shift ... what the root cause of that is.

Almost certain this is a GlobeView or globe-projection issue - due to the way the TileLayer are projected at different resolutions. This is something that I want to address asap. But feels like this could land before polishing the projection?

I see a lot of z-fighting as we zoom into the final destination

Yeah it resolves ever-so-slightly faster in the new strategy due to the center priority, but its nowhere near as bad when testing with the TerrainLayer.

@charlieforward9
charlieforward9 force-pushed the codex/tile-priority-on-master-demo branch from 1321c68 to 149a855 Compare June 6, 2026 17:42
@charlieforward9
charlieforward9 force-pushed the codex/tile-priority-on-master-demo branch from a32e93b to 2b5d3cc Compare June 10, 2026 20:12
@charlieforward9 charlieforward9 changed the title Add coverage LOD tile prefetching feat(geo-layers): coverage LOD tile prefetching Jun 10, 2026
@chrisgervang chrisgervang mentioned this pull request Jun 11, 2026
13 of 59 tasks
@chrisgervang chrisgervang added this to the v9.4 milestone Jun 11, 2026
@charlieforward9 charlieforward9 linked an issue Jun 13, 2026 that may be closed by this pull request
14 of 35 tasks
@charlieforward9 charlieforward9 removed a link to an issue Jun 13, 2026
14 of 35 tasks
@charlieforward9 charlieforward9 mentioned this pull request Jun 23, 2026
14 of 35 tasks
@charlieforward9

Copy link
Copy Markdown
Member Author

There's a lot of z-fighting in the before as well, so this isn't a regression and more a limitation with our renderer

Willing to put this into the 9.4 release as a means of moving this forward without the risk of regression?

@chrisgervang

@charlieforward9

Copy link
Copy Markdown
Member Author

@copilot resolver los conflictos de combinación en esta rama.

Copilot AI commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

@copilot resolver los conflictos de combinación en esta rama.

Merge conflicts resolved in 4f61a0b (initial merge) and fixed in the follow-up commit. The resolution:

  • terrain-layer.ts: included both lodStrategy and zoomOffset in props destructuring
  • tile-2d-header.ts: adopted getRequestPriority (master's rename)
  • tileset-2d.ts: combined coverage LOD prefetch tiers with master's center-distance priority — selected/visible tiles now use viewport-center distance ordering within their tiers, and prefetch tiles remain in the third tier by zoom proximity
  • Test files: kept both coverage LOD tests and the new center-priority tests from master

All 29 tests pass.

@greptile-apps

greptile-apps Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[High impact] No blocking issues were found in the reviewed code.

Summary

Adds opt-in tile coverage prefetching so coarse tiles can remain visible while sharper tiles load.

  • Coverage mode fetches coarse ancestor tiles while detailed tiles load.
  • Evicted tile requests stop contributing to the shared cache.

No new actionable issues found. The earlier eviction, globe fallback, and release-note concerns are addressed. The demo lockfile concern was withdrawn after charlieforward9 explained that test apps use the root lockfile and ignore nested lockfiles.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Select tiles for each view] --> B{Coverage enabled?}
  B -->|No| D[Request selected tiles]
  B -->|Yes| C[Add parent and coarse ancestors]
  C --> D
  D --> E[Load selected tiles, visible placeholders, then coverage]
  E --> F[Show loaded tiles and available fallbacks]
  F --> G[Evict unused tiles when over budget]
  G --> H[Abort evicted requests and remove counted bytes]
Loading

Reviews (5) · Last reviewed commit: "test(geo-layers): add lodStrategy before..." · Reviewed by Greptile

@ibgreen ibgreen mentioned this pull request Sep 16, 2026
14 of 70 tasks
@charlieforward9 charlieforward9 changed the title feat(geo-layers): coverage LOD tile prefetching feat(geo-layers): coverage LOD tile prefetching (2/2) Oct 26, 2026
@charlieforward9
charlieforward9 changed the base branch from master to cr/fix-globe-mercator-tiles October 26, 2026 03:33
charlieforward9 and others added 4 commits November 17, 2026 19:11
Add the opt-in `lodStrategy: 'coverage'` tileset option. For the selected
tiles of each view it requests the parent and the ancestor at `minZoom`
(zoom 6, with a zoom 4 fallback, on globes). Coverage requests run after
selected and visible tiles, are not aborted while needed, and are evicted
after stale tiles. Independent consumers pass their own coverage, which is
unioned like selected and visible tiles.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…2DLayer

Forward the `lodStrategy` tileset option from TileLayer, TerrainLayer and
the proposals Tile2DLayer, and document it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With coverage, the ancestor at `minZoom` is nearly always loaded, so
`best-available` showed it instead of sharper loaded tiles. After zooming
out by two levels, a pending tile showed the zoom 0 tile even though its
loaded zoom 12 child was cached. Pending tiles now also show their loaded
descendants on top of the coverage ancestor, as they would without it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@charlieforward9
charlieforward9 removed this pull request from stack #10929 November 18, 2026 00:23
@charlieforward9
charlieforward9 force-pushed the codex/tile-priority-on-master-demo branch from 6f9841c to d9b0105 Compare November 18, 2026 00:23
@cursor

cursor Bot commented Nov 18, 2026

Copy link
Copy Markdown

This PR is too large for Bugbot to review. It changes 59,991 lines and 3,788,152 characters. Split the change into smaller pull requests to get a review.

@charlieforward9 charlieforward9 changed the title feat(geo-layers): coverage LOD tile prefetching (2/2) feat(geo-layers): coverage LOD tile prefetching (1/2) Nov 18, 2026
@charlieforward9
charlieforward9 changed the base branch from cr/fix-globe-mercator-tiles to master November 18, 2026 00:23
@athomct

athomct commented Nov 22, 2026

Copy link
Copy Markdown

I opened #11286. It is an opt-in TileLayer prop that loads the tiles of the view transition target while a fly-to runs. It does not depend on this PR, and the two combine well. I measured both on a synthetic slow network (400 ms latency, 2 requests at a time), with a linear fly-in from z5 to z14, 3 runs, medians:

detail deficit stop → full detail
master 34.8 1834 ms
this PR 30.8 1867 ms
#11286 38.5 −34 ms
both 29.7 −34 ms

This PR lowers the deficit during the flight. #11286 removes the wait after the stop. With heavy MVT tiles, the deficit is 72.3 on master, 39.9 with this PR and 36.2 with both. When this PR merges, I will merge master into #11286 and run the bench again. The bench and the merged branch are ready if you want to try the combination.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants