From bd278140bcc7e7d433917f14e99038f2e6453027 Mon Sep 17 00:00:00 2001 From: Luke Date: Mon, 11 Nov 2024 14:06:15 -0800 Subject: [PATCH] fix: fixed wasm --- shell.nix | 1 + tetanes/Cargo.toml | 6 +++++- tetanes/src/nes/renderer/gui/ppu_viewer.rs | 4 ---- tetanes/src/sys/platform/wasm.rs | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/shell.nix b/shell.nix index c9271124..e8ba4571 100644 --- a/shell.nix +++ b/shell.nix @@ -14,6 +14,7 @@ with (import { ]; targets = ["wasm32-unknown-unknown"]; })) + trunk udev ]; diff --git a/tetanes/Cargo.toml b/tetanes/Cargo.toml index 0627f401..4adeb0fb 100644 --- a/tetanes/Cargo.toml +++ b/tetanes/Cargo.toml @@ -76,7 +76,11 @@ tracing.workspace = true tracing-subscriber.workspace = true uuid = { version = "1.10", features = ["v4", "fast-rng", "serde"] } webbrowser = { version = "1.0", features = ["hardened", "disable-wsl"] } -wgpu = { version = "23.0", features = ["webgl", "webgpu"] } +wgpu = { version = "23.0", features = [ + "webgl", + "webgpu", + "fragile-send-sync-non-atomic-wasm", # Safe because we're not enabling atomics +] } winit = { version = "0.30", features = ["serde"] } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] diff --git a/tetanes/src/nes/renderer/gui/ppu_viewer.rs b/tetanes/src/nes/renderer/gui/ppu_viewer.rs index 26ca027b..bff79ff2 100644 --- a/tetanes/src/nes/renderer/gui/ppu_viewer.rs +++ b/tetanes/src/nes/renderer/gui/ppu_viewer.rs @@ -345,10 +345,6 @@ impl PpuViewer { let open = Arc::clone(&self.open); let state = Arc::clone(&self.state); - // let Some(cfg) = self.resources.take() else { - // warn!("PpuViewer::prepare was not called with required resources"); - // return; - // }; let mut viewport_builder = egui::ViewportBuilder::default() .with_title(Self::TITLE) diff --git a/tetanes/src/sys/platform/wasm.rs b/tetanes/src/sys/platform/wasm.rs index 34539222..f1656c8e 100644 --- a/tetanes/src/sys/platform/wasm.rs +++ b/tetanes/src/sys/platform/wasm.rs @@ -356,7 +356,7 @@ pub mod renderer { (viewport_ui_cb, raw_input.take()) }; - let mut output = ctx.run(raw_input, |ctx| match viewport_ui_cb { + let mut output = ctx.run(raw_input, |ctx| match &viewport_ui_cb { Some(viewport_ui_cb) => viewport_ui_cb(ctx), None => gui.borrow_mut().ui(ctx, None), });