bevyengine/bevy

Removing image crate from wasm builds

Opened this issue · 0 comments

What problem does this solve or what need does it fill?

There is no need for a full-on image parsing library on wasm builds, as the user agent integrates plenty of image parser. It's also possible to directly initialize images from such sources. Either through HTMLImageElement or ImageData.

This would improve the loading times, by removing the image parser running in wasm, and the delivery time of the wasm file itself, as I assume that the image crate itself is quite heavy.

This is also needed for video support on Web, as there is not really any other option. Any sort of software encoding would be probably too slow or cost a lot cpu.

What solution would you like?

Switching over to using HTMLImageElement, but this would require to somehow prevent the AssetServer from fetching, and the AssetLoader getting the full url to create an HTMLImageElement which is handed over to wgpu.

What alternative(s) have you considered?

Additional context

Requires gfx-rs/wgpu#5668