Synchronize StyleLayer and Bucket/Buffer state
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
The state needed by the painter_xxx modules to render tiles is split up into two places:
- The map-wide
Style/StyleLayerstructure, which dictates the layers to be rendered, their types, and the layout/paint definitions that control their details. - The per-source
Tileobjects (managed bySourceCache, populated bySources, often viaWorkerrequests), which holdBuckets (one per StyleLayer) of buffers containing vertex positions, colors, etc.
These can get out of sync when client code mutates the Style, e.g.:
- Using
setPaintPropertyto change a constant to a property function - Removing and re-adding a layer https://github.com/mapbox/mapbox-gl-js/issues/3895#issuecomment-273565708
- (pending) changing the style's sprite sheet https://github.com/mapbox/mapbox-gl-js/pull/3662#issuecomment-262115507
In each of these cases, we have to work around the possibility that when the Style is updated, we could have one or more render cycles where some Tiles are stale, carrying Bucket state that corresponds to the pre-updated style layers.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how Style and StyleLayer updates reach Tile, SourceCache, Source, Worker, and the painter_xxx modules, then inspect Bucket state during render cycles. Reproduce the listed mutations, including setPaintProperty and removing and re-adding a layer. Done means stale Bucket state cannot be used after a style update.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- computer-graphics
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100