Skip to content

Commit d3a400f

Browse files
committed
reworking showcase resource handling in prep for wasm
1 parent 8504418 commit d3a400f

9 files changed

Lines changed: 40 additions & 190 deletions

File tree

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@ exclude = [
3030
[workspace.dependencies]
3131
wgpu = "28.0"
3232
anyhow = "1"
33-
rand = "0.8"
3433
glam = { version = "0.30.9", features = ["bytemuck"] }
3534
bytemuck = { version = "1.13.1", features = ["derive"] }
3635
winit = { version = "0.30", features = ["android-native-activity"] }
3736
env_logger = "0.10"
3837
pollster = "0.3"
3938
image = "0.24.2"
4039
log = "0.4"
41-
tobj = { version = "3.2", default-features = false, features = ["async"]}
40+
tobj = { version = "3.2", default-features = false, features = ["async"] }

code/showcase/framework/Cargo.toml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,27 @@ winit.workspace = true
1818
thiserror = "1.0"
1919
bytemuck = { version = "1.24", features = [ "derive" ] }
2020
cgmath = "0.18"
21-
wgpu-subscriber = "0.1"
21+
# wgpu-subscriber = "0.1"
2222
slotmap = "1.1.1"
23-
reqwest = "0.13.1"
23+
rand = "0.8"
24+
25+
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
2426
async-fs = "2.2.0"
27+
28+
[target.'cfg(target_arch = "wasm32")'.dependencies]
29+
getrandom = { version = "*", features = ["js"] }
30+
reqwest = "0.13.1"
2531
wasm-bindgen-futures = "0.4.58"
32+
console_error_panic_hook = "0.1"
33+
console_log = "1.0"
34+
wasm-bindgen = "0.2"
35+
web-sys = { version = "0.3", features = [
36+
"Document",
37+
"Window",
38+
"Element",
39+
"Location",
40+
]}
41+
instant = { version = "0.1", features = [ "wasm-bindgen" ] }
2642

2743
[build-dependencies]
2844
anyhow = "1.0"

code/showcase/framework/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ pub use resources::model::*;
1515
pub use resources::texture::*;
1616
pub use shader_canvas::*;
1717

18+
pub use rand;
19+
1820
// use cgmath::*;
1921
use std::ops::Deref;
2022
use std::sync::Arc;
@@ -293,6 +295,7 @@ impl<D: Demo + 'static> ApplicationHandler<anyhow::Result<(Display, D)>> for App
293295
{
294296
use wasm_bindgen::JsCast;
295297
use winit::platform::web::WindowAttributesExtWebSys;
298+
use wasm_bindgen_futures::wasm_bindgen::UnwrapThrowExt;
296299

297300
const CANVAS_ID: &str = "canvas";
298301

@@ -416,7 +419,7 @@ impl<D: Demo + 'static> ApplicationHandler<anyhow::Result<(Display, D)>> for App
416419
}
417420

418421
pub fn run<D: Demo>() -> anyhow::Result<()> {
419-
wgpu_subscriber::initialize_default_subscriber(None);
422+
// wgpu_subscriber::initialize_default_subscriber(None);
420423

421424
let event_loop = EventLoop::with_user_event().build()?;
422425
let mut app = App::<D>::new(&event_loop);

0 commit comments

Comments
 (0)