Mapbox-gl-js: Consider using OffscreenCanvas wherever possible

Created on 1 Apr 2019  路  3Comments  路  Source: mapbox/mapbox-gl-js

OffscreenCanvas is now available in Chrome, Firefox and Opera. Very soon it will be available in Edge also, since they are switching over to chromium this year.

https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas

Taking advantage of the above feature and moving the rendering pipeline into a webworker would ensure a consistently smooth 60FPS at all times, due to rendering being decoupled from the the user's input, and the main thread being kept free at all times.

This is something that should definitely be considered going forward as the user experience and performance advantages would be phenomenal.

performance

Most helpful comment

Sort of compiling gl-native to wasm (hopefully that will be done when Webseembly Threads are widely supported) - Offscreen canvas is our best hope for quantum jump in GL-JS performance.

I nudged the Webkit/Safari team to make it a priority to add Offscreen support (which will also mean we get Webp and many other things as bonus).

if more people petition Apple/Webkit - hopefully Offscreen canvas happens sooner. Webkit Bugzilla link:
https://bugs.webkit.org/show_bug.cgi?id=183720

Irrespective given widespread suport already available, Mapbox team should consider adding support for rendering tiles using Offscren canvas.

All 3 comments

Sort of compiling gl-native to wasm (hopefully that will be done when Webseembly Threads are widely supported) - Offscreen canvas is our best hope for quantum jump in GL-JS performance.

I nudged the Webkit/Safari team to make it a priority to add Offscreen support (which will also mean we get Webp and many other things as bonus).

if more people petition Apple/Webkit - hopefully Offscreen canvas happens sooner. Webkit Bugzilla link:
https://bugs.webkit.org/show_bug.cgi?id=183720

Irrespective given widespread suport already available, Mapbox team should consider adding support for rendering tiles using Offscren canvas.

Any progress ? :)

In case you'd find it interesting, the W3C Maps for HTML Community Group has an article from Andreas Hocevar on the (experimental) implementation of OffscreenCanvas for OpenLayers here: https://www.w3.org/community/maps4html/2020/04/07/better-web-maps-with-new-browser-features/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iamdenny picture iamdenny  路  3Comments

BernhardRode picture BernhardRode  路  3Comments

bgentry picture bgentry  路  3Comments

muesliq picture muesliq  路  3Comments

stevage picture stevage  路  3Comments