Support WebGL2 and WebGPU in the same WASM file #13168
Labels
A-Rendering
Drawing game state to the screen
C-Feature
A new feature, making something new possible
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
D-Complex
Quite challenging from either a design or technical perspective. Ask for help!
M-Needs-Release-Note
Work that should be called out in the blog due to impact
O-Web
Specific to web (WASM) builds
S-Ready-For-Implementation
This issue is ready for an implementation PR. Go for it!
What problem does this solve or what need does it fill?
Bevy currently forces you to choose either WebGL2 or WebGPU when building a project. This is one extra thing that developers need to think about when deploying their games, which is already a complicated enough process.
Since the web is a large, incredibly portable platform, we should attempt to make targeting it as painless as possible.
What solution would you like?
In gfx-rs/wgpu#5044, WGPU added support for detecting WebGL2 and WebGPU at runtime. I think integrating this into Bevy would be incredibly useful, and give WebGPU more exposure. This would be achieved through the existing
webgl2
andwebgpu
features.webgl2
enabled?webgpu
enabled?Questions
--cfg=web_sys_unstable_apis
, and do we handle this already?What alternative(s) have you considered?
error!(...)
macro may be preferred because it will be visible in the Javascript console.error!
may be preferred.Additional context
cc @Elabajaba, who originally migrated Bevy to the WGPU version that introduced this feature.
The text was updated successfully, but these errors were encountered: