Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bloom wasm support #8631

Merged
merged 5 commits into from
May 19, 2023
Merged

Fix bloom wasm support #8631

merged 5 commits into from
May 19, 2023

Conversation

vallrand
Copy link
Contributor

Objective

Solution

GLES doesn't support binding specific mip levels for sampling. Fallback to using separate textures instead.


@mockersf
Copy link
Member

Nice, thank you for doing this!

Could you set wasm to true in https://github.com/vallrand/bevy/blob/wasm-bloom/Cargo.toml#L277 and https://github.com/vallrand/bevy/blob/wasm-bloom/Cargo.toml#L538?

@mockersf mockersf added A-Rendering Drawing game state to the screen O-Web Specific to web (WASM) builds labels May 18, 2023
@JMS55 JMS55 self-requested a review May 18, 2023 15:40
@JMS55
Copy link
Contributor

JMS55 commented May 18, 2023

Needs a comment in the code explaining why we need a fallback for webgl2 and how the fallback is multiple textures instead of mips.

Also, did you test that this works ok in practice? Iirc there are problems with HDR on wasm (maybe only when used with MSAA?), regardless of bloom.

@mockersf
Copy link
Member

works for me in WebGL2

@JMS55
Copy link
Contributor

JMS55 commented May 19, 2023

This shouldn't work? See https://docs.rs/bevy/latest/bevy/prelude/struct.Camera.html#structfield.hdr

Turning hdr on uses Rgba16Float textures for the ViewTarget, which shouldn't work with MSAA, and supposedly should outright crash with MSAA + WebGL2.

EDIT: Tried it myself, works fine 👀. Guess it got fixed on wgpu's end. I'll open a PR to update the docs.

@JMS55
Copy link
Contributor

JMS55 commented May 19, 2023

#8634

@cart cart added this pull request to the merge queue May 19, 2023
Merged via the queue into bevyengine:main with commit f76b3c4 May 19, 2023
@MAG-AdrianMeredith
Copy link

just out of interest, does this workaround apply to webgpu version of wasm?

@mockersf
Copy link
Member

mockersf commented May 22, 2023

No, bloom already works in WebGPU, you can check it here on a compatible browser: https://bevyengine.org/examples-webgpu/2D%20Rendering/bloom-2d/

This fix is only for WebGL2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen O-Web Specific to web (WASM) builds
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WASM does not work with HDR
6 participants