Allowing users to compile wgpu without the webgl flag in wasm builds

Currently wgpu supports two backends on the web: webgl and webgpu, and only one of them can be used in a single build. In order to use webgpu on the web you need to omit the webgl feature flag of wgpu. There is a tracking issue for making it so that wgpu lets you select the web backend at runtime but unclear when that will be done.

This is a problem for iced because the iced/wgpu crate enables the wgpu/webgl feature which forces users of iced to use this feature flag when compiling to wasm, removing their ability to use the webgpu backend. I’m not aware of a way for cargo users to remove a feature from a sub-dependency like would be a fix for this case.

I propose that iced makes the wgpu/webgl feature flag be a default feature of the iced/wgpu crate so that it can be easily disabled by users by specifying default-features = false.

Sounds good!

I think we should make WebGPU the default backend on web, considering major browsers are already shipping it.

I’ll get to it later.

1 Like