Skip to content

[PoC] WebGPU Backend#7411

Draft
birkskyum wants to merge 97 commits intomainfrom
webgpu-backend
Draft

[PoC] WebGPU Backend#7411
birkskyum wants to merge 97 commits intomainfrom
webgpu-backend

Conversation

@birkskyum
Copy link
Copy Markdown
Member

@birkskyum birkskyum commented Apr 5, 2026

This is Mirroring (with AI assistance) the drawables-based WebGPU backend from Native to GL JS, without really changing the webgl1/2 backend - this is largely additive to avoid breaking existing functionality. The goal here is to understand the scope required for landing webgpu, and the bundle size impact (we're looking at ~200kb before gzip). This impl. does not use Luma.GL

Screenshot 2026-04-05 at 15 23 23 Screenshot 2026-04-05 at 13 10 32 Screenshot 2026-04-05 at 15 23 09

What's working

  • Most layers (fill, line, x-pattern, x-outline, symbol, circle)
  • 3d Buildings (bit of z-fighting)
  • 3D Terrain and hillshade
  • Raster
  • Deckgl layer integration

What's missing

  • Sky/Fog
  • Globe

To keep the diff "small" i didn't move all the webgl code to a separte webgl folder, but it would arguably be good similar to native to have webgl and webgpu well separted - it would be easier after webgl has migrated to drawables.

I've added a backend flag to the render test harness, webgl1/webgl2/webgpu to force using one of them.

Launch Checklist

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Link to related issues.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality.
  • Document any changes to public APIs.
  • Post benchmark scores.
  • Add an entry to CHANGELOG.md under the ## main section.

@birkskyum birkskyum changed the title [experimental] WebGPU Backend [PoC] WebGPU Backend Apr 5, 2026
* @returns A list of tile coordinates, ordered by ascending distance from camera.
*/
export function coveringTiles(transform: IReadonlyTransform, options: CoveringTilesOptionsInternal): OverscaledTileID[] {
if (!transform.width || !transform.height) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look like debug leftovers...?

@HarelM
Copy link
Copy Markdown
Collaborator

HarelM commented Apr 5, 2026

This is a very nice work, I'm just not sure what should be done with all this code...?

@HarelM
Copy link
Copy Markdown
Collaborator

HarelM commented Apr 6, 2026

Can we create a web gpu build maybe in parallel to the regular one?
Also it's worth looking at this PR and see what parts can be extracted to smaller PR that doesn't change the current code to facilitate for this change.

@birkskyum birkskyum mentioned this pull request Apr 6, 2026
8 tasks
@CommanderStorm
Copy link
Copy Markdown
Member

So since the main motivation was performance (?), what does the performance of this vs webgl look like?

@birkskyum
Copy link
Copy Markdown
Member Author

birkskyum commented Apr 12, 2026

I haven't ran a bench yet, but so far it looks slower, so there is more optimisation work needed.

It's not only about performance of MapLibre in isolation, it's also compatibility with e.g. deckgl in interleaved webgpu mode. The data-viz layer (or large symbol layers) might be where the real perf is won.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants