maplibre / maplibre-rs

Experimental Maps for Web, Mobile and Desktop
Apache License 2.0
1.35k stars 79 forks source link

Use browser API to decode images #258

Open maxammann opened 1 year ago

maxammann commented 1 year ago

We use right now the image create to read PNG files. We also use this in the web version of maplibre-rs. Using the native decoder could speed up the decoding drastically.

🤔 Expected Behavior

Speed!

😯 Current Behavior

It's not slow but also not super fast.

💁 Possible Solution

Since wgpu 15.0 there is support to queue textures from webassembly: https://github.com/gfx-rs/wgpu/blob/master/CHANGELOG.md#queuecopy_external_image_to_texture-on-webassembly

maxammann commented 3 months ago

Note that this currently requires nightly firefox https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/copyExternalImageToTexture#browser_compatibility