mapbox / mapbox/mapbox-gl-js

Remove SegmentVector abstraction

Open
#11,171 1 comment 0 reactions 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

We introduced `SegmentVector` class to be able to render layers with >2^16 vertices — by maintaining multiple views ("segments") in the vertex array with different offsets. However, according to [WebGL best practices](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices), `OES_element_index_uint` extension that allows 32-bit vertex indexing as opposed to 16-bit one is universally supported and can be relied upon. We could use it to remove the segments abstraction, using the extension to render >2^16 vertices with a single draw draw call, and removing the complexity around splitting and maintaining segments.

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 locating the SegmentVector class and the code that maintains segment offsets, then inspect the WebGL index-buffer path and OES_element_index_uint support. Done means the segment abstraction and its maintenance complexity are removed while layers with more than 2^16 vertices render through a single draw call.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.