bevyengine / bevyengine/bevy

Removing image crate from wasm builds

Open
#13,247 2 comments 0 reactions 0 assignees View on GitHub
A-Rendering C-Dependencies C-Performance D-Modest O-Web S-Blocked X-Contentious
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## 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 https://github.com/gfx-rs/wgpu/pull/5668

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.