mapbox / mapbox/mapbox-gl-js

Synchronize StyleLayer and Bucket/Buffer state

Open
#4,012 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

refactoring :building_construction:
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 / StyleLayer structure, which dictates the layers to be rendered, their types, and the layout/paint definitions that control their details.
  • The per-source Tile objects (managed by SourceCache, populated by Sources, often via Worker requests), which hold Buckets (one per StyleLayer) of buffers containing vertex positions, colors, etc.

These can get out of sync when client code mutates the Style, e.g.:

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.