mapbox / mapbox/mapbox-gl-js

Render passes do some unnecessary stencil clipping mask work

Open
#5,699 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

performance :zap: refactoring :building_construction:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

In the opaque and translucent render passes, we iterate over every layer and prepare any new sources by [rendering their clipping masks](https://github.com/mapbox/mapbox-gl-js/blob/485ff9f03712cd1d4b1506ae99b47b9b65fc0e37/src/render/painter.js#L382) before we actually check for whether that source is needed yet in that render pass (which happens in [per-layer render functions](https://github.com/mapbox/mapbox-gl-js/blob/485ff9f03712cd1d4b1506ae99b47b9b65fc0e37/src/render/painter.js#L387)). This means that we're probably drawing unnecessary clipping masks at least a few times, more in maps with more sources.

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 in src/render/painter.js at the linked opaque and translucent render-pass logic, then follow the per-layer render functions where source usage is checked. Confirm when sources are actually needed before preparing their clipping masks, and verify that unnecessary stencil mask work no longer occurs across the render passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics, performance
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.