Skip to content

Commit e3c3a6c

Browse files
srperensclaude
andcommitted
fix(frontend): keep wgpu out of the WASM build
eframe 0.34.2 added `wgpu` to its `default` feature set (it was not a default in 0.34.1, which the #580 cargo update bumped past). That pulled wgpu-core into the wasm32-unknown-unknown build, where it fails to compile (`cannot find value Vulkan in module hal::api`). Disable eframe's default features at the workspace level and re-add the features that previously came from `default`: - native: wgpu, accesskit, wayland, x11 - wasm: web_screen_reader (glow comes from the workspace-level features) Gate the `CreationContext::wgpu_render_state` access in info_page.rs behind cfg(not(wasm32)); that field only exists with the wgpu feature, so WASM now falls through to the glow/WebGL branch. Cargo.lock drops the Wayland/Adwaita client-side-decoration chain (sctk-adwaita, tiny-skia, ttf-parser, ...) that only came in via winit/default. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent a578c01 commit e3c3a6c

4 files changed

Lines changed: 17 additions & 86 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 82 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ garde = { version = "0.23", features = ["derive"] }
5151
# Frontend
5252
egui = "0.34"
5353
egui-phosphor = "0.12"
54-
eframe = { version = "0.34", features = ["default_fonts", "persistence", "glow"] }
54+
# default-features disabled: eframe 0.34's `default` set includes `wgpu`, which
55+
# would otherwise be pulled into the WASM build where wgpu fails to compile.
56+
# Native-only renderer/platform features (wgpu, accesskit, wayland, x11) are
57+
# re-added on the non-wasm target in frontend/Cargo.toml.
58+
eframe = { version = "0.34", default-features = false, features = ["default_fonts", "persistence", "glow"] }
5559
egui_extras = { version = "0.34", features = ["image"] }
5660
egui_plot = "0.35"
5761
reqwest = { version = "0.13", default-features = false, features = ["json", "rustls"] }

frontend/Cargo.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ base64 = "0.22"
4545

4646
# WASM-specific dependencies
4747
[target.'cfg(target_arch = "wasm32")'.dependencies]
48+
# web_screen_reader (screen-reader accessibility) was part of eframe's `default`
49+
# set, which is disabled at the workspace level; re-add it for WASM. glow renderer
50+
# comes from the workspace-level features.
51+
eframe = { workspace = true, features = ["web_screen_reader"] }
4852
# Cross-platform time - needs wasm-bindgen feature for WASM
4953
instant = { version = "0.1", features = ["wasm-bindgen"] }
5054
gloo-net.workspace = true
@@ -60,8 +64,10 @@ wasm-bindgen = "0.2"
6064
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
6165
# System hostname detection (for generating external URLs)
6266
hostname = "0.4"
63-
# Enable wgpu renderer for native (macOS Metal support) - not available for WASM
64-
eframe = { workspace = true, features = ["wgpu"] }
67+
# Enable wgpu renderer for native (macOS Metal support) - not available for WASM.
68+
# accesskit/wayland/x11 were part of eframe's `default` set, which is disabled at
69+
# the workspace level to keep wgpu out of the WASM build; re-add them here.
70+
eframe = { workspace = true, features = ["wgpu", "accesskit", "wayland", "x11"] }
6571
# Cross-platform time (standard for native)
6672
instant = "0.1"
6773
tokio = { workspace = true, features = ["rt-multi-thread", "macros", "sync"] }

frontend/src/info_page.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ pub struct RendererInfo {
2020
/// Detect the active rendering backend from eframe's CreationContext.
2121
/// Checks which renderer is actually active at runtime.
2222
pub fn detect_renderer(cc: &eframe::CreationContext<'_>) -> RendererInfo {
23-
// wgpu renderer detection
23+
// wgpu renderer detection. The `wgpu_render_state` field only exists when
24+
// eframe is built with the `wgpu` feature, which we enable on native only
25+
// (WASM uses glow/WebGL), so this block must be gated to native targets.
26+
#[cfg(not(target_arch = "wasm32"))]
2427
if let Some(render_state) = &cc.wgpu_render_state {
2528
let info = render_state.adapter.get_info();
2629
let mut details = vec![

0 commit comments

Comments
 (0)