From f228ed2232d3a6b3c223583fd2ef5dabb6dc8171 Mon Sep 17 00:00:00 2001 From: Zachary Harvie Date: Tue, 25 Aug 2026 05:16:33 -0700 Subject: [PATCH] Fix `egui-wgpu` build on `wasm32-unknown-emscripten` (#8454) Fix a build issue in the `egui-wgpu` crate when building for the `wasm32-unknown-emscripten` target. WGPU does not support the WebGPU backend on that target. --- crates/egui-wgpu/src/setup.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/egui-wgpu/src/setup.rs b/crates/egui-wgpu/src/setup.rs index 3909a9b53..3c9ceae5d 100644 --- a/crates/egui-wgpu/src/setup.rs +++ b/crates/egui-wgpu/src/setup.rs @@ -101,7 +101,10 @@ impl WgpuSetup { let mut backends = create_new.instance_descriptor.backends; // Don't try WebGPU if we're not in a secure context. - #[cfg(target_arch = "wasm32")] + // Emscripten is excluded: wgpu gates both its `webgpu` backend and + // its `web_sys` re-export on `not(Emscripten)` (see the cfg aliases + // in `wgpu/build.rs`). + #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] if backends.contains(wgpu::Backends::BROWSER_WEBGPU) { let is_secure_context = wgpu::web_sys::window().is_some_and(|w| w.is_secure_context());