mapbox / mapbox/mapbox-gl-js

Unset `fill-outine-color` duplicates `fill-color` paint buffer if the latter is data-driven

Open
#10,579 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

When a `fill` layer has a data-driven `fill-color` but `fill-outline-color` is unset (which is very common in our styles), it inherits the value and we end up uploading two identical, independently generated paint buffers, increasing the GPU memory footprint of rendering such layers:

https://github.com/mapbox/mapbox-gl-js/blob/4eeefaee04b92ebfb18f5b9bc1626264b4f03779/src/style/style_layer/fill_style_layer.js#L53-L56

We should optimize this somehow — maybe add special code to reuse the `fill-color` paint buffer for the outline if the value is undefined?

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/style/style_layer/fill_style_layer.js around lines 53-56 and trace how an unset fill-outline-color inherits the data-driven fill-color. Determine how the paint buffers are generated, then verify that the optimization avoids duplicate GPU buffers without changing fill rendering behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.