eframe_template icon indicating copy to clipboard operation
eframe_template copied to clipboard

Default to wgpu renderer

Open emilk opened this issue 2 months ago • 3 comments

Unfortunately, just switching glow to wgpu causes build errors for web, and runtime errors on native. Apparently we also need to turn on some wgpu features, but that… sucks. And it is not obvious from the eframe docs. This needs fixing.

Native

> cargo run
thread 'main' panicked at /Users/emilk/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wgpu-27.0.1/src/api/instance.rs:65:13:
No wgpu backend feature that is implemented for the target platform was enabled. See `wgpu::Instance::enabled_backend_features()` for more information.

Web

error[E0433]: failed to resolve: could not find `web_sys` in `wgpu`
   --> /Users/emilk/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/egui-wgpu-0.33.0/src/setup.rs:58:31
    |
58  |                         wgpu::web_sys::window().is_some_and(|w| w.is_secure_context());
    |                               ^^^^^^^ could not find `web_sys` in `wgpu`
    |
note: found an item that was configured out
   --> /Users/emilk/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wgpu-27.0.1/src/lib.rs:143:9
    |
143 | pub use web_sys;
    |         ^^^^^^^
note: the item is gated here
   --> /Users/emilk/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wgpu-27.0.1/src/lib.rs:142:1
    |
142 | #[cfg(web)]
    | ^^^^^^^^^^^

emilk avatar Oct 10 '25 06:10 emilk

Maybe it's stupid question, but is there a workaround for this? I looked for the possibility to enable feature of dependencies's dependences, but that doesn't seem possible.

kasper64 avatar Oct 19 '25 17:10 kasper64

The work-around is as simple as adding an extra dependency on wgpu with default features enabled:

wgpu = { version = "27.0.1", default-features = true }

I'll see if we could/should do that in eframe already somehow to make this easier

emilk avatar Nov 11 '25 17:11 emilk

Hey there @emilk , frame_template (with rust 1.88 and egui 0.33.0) with wgpu crashes on my M4 Mac (26.0.1). It has been doing this for a while. Glow works fine. Wgpu used to work.

Steps:

  1. Clone eframe_template
  2. Change feature "glow" to "wgpu"
  3. cargo run
  4. Crash.
thread 'main' panicked at /Users/me/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wgpu-27.0.1/src/api/instance.rs:65:13:
No wgpu backend feature that is implemented for the target platform was enabled. See `wgpu::Instance::enabled_backend_features()` for more information.

White-Rabbit-Scientific avatar Nov 17 '25 02:11 White-Rabbit-Scientific