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

Please consider leaving the wgpu backend and features selection up to the user of the iced-wgpu crate.

Right now the wgpu dependency in the iced workspace has all the default features enabled. wgpu allows the selection of supported (and compiled) backends to be selected via features. However as a user of iced I can not un-select specific backend features as iced-wgpu has all the default features enabled via its workspace dependency on wgpu.

As a library user of iced it would great if default-features = false was set for the wgpu dependency in Cargo.toml in the workspace.