Skip to content

Commit

Permalink
升级 app-surface | winit, 解决在 macOS Sonoma 上的崩溃
Browse files Browse the repository at this point in the history
  • Loading branch information
jinleili committed Oct 22, 2023
1 parent 4c43add commit f275f22
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 468 deletions.
496 changes: 57 additions & 439 deletions Cargo.lock

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ version = "0.24"
default-features = false

[workspace.dependencies]
app-surface = "0.3.1"
app-surface = "0.3.3"
# app-surface = { git = "https://github.com/jinleili/wgpu-in-app", rev = "0dcf485" }
# app-surface = { path = "../idroid/wgpu-in-app/app-surface", default-features = false }
bytemuck = { version = "1.13", features = ["derive"] }
bytemuck = { version = "1.14", features = ["derive"] }
cfg-if = "1"
glam = "0.24"
env_logger = "0.10"
Expand All @@ -36,16 +35,16 @@ instant = "0.1"
log = "0.4"
naga = { version = "0.13" }
pollster = "0.3"
rayon = "1.4"
rayon = "1.8"
tobj = "3.2"
winit = "0.27.5"
winit = "0.28.7"
wgpu = { version = "0.17" }
# wgpu = { git = "https://github.com/gfx-rs/wgpu", rev = "757245cd" }
utils = { path = "code/utils" }

# wasm32 dependencies
console_error_panic_hook = "0.1.7"
console_log = "0.2.0"
console_log = "1.0"
reqwest = { version = "0.11" }
js-sys = "0.3.64"
wasm-bindgen = "0.2.87"
Expand All @@ -54,7 +53,7 @@ web-sys = "0.3.64"

# build-dependencies
anyhow = "1.0"
fs_extra = "1.2"
fs_extra = "1.3"
glob = "0.3"

[profile.release]
Expand Down
4 changes: 2 additions & 2 deletions code/showcase/compute/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env_logger.workspace = true
pollster.workspace = true
image = "0.24"
log = "0.4"
rayon = "1.4"
rayon.workspace = true
tobj = "2.0"
wgpu.workspace = true
winit.workspace = true
Expand All @@ -21,6 +21,6 @@ winit.workspace = true
anyhow.workspace = true
fs_extra.workspace = true
glob.workspace = true
rayon = "1.4"
rayon.workspace = true
# naga 的接口有变化,用新版本得修改 build.rs
naga = { version = "0.11", features = ["glsl-in", "spv-out", "wgsl-out"] }
8 changes: 4 additions & 4 deletions code/showcase/framework/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2018"
[dependencies]
anyhow = "1.0"
thiserror = "1.0"
bytemuck = { version = "1.13", features = [ "derive" ] }
bytemuck = { version = "1.14", features = [ "derive" ] }
glam.workspace = true
env_logger = "0.10"
pollster = "0.3"
Expand All @@ -18,8 +18,8 @@ wgpu.workspace = true
winit.workspace = true

[build-dependencies]
anyhow = "1.0"
fs_extra = "1.2"
anyhow.workspace = true
fs_extra.workspace = true
glob = "0.3"
naga = { version = "0.9", features = ["glsl-in", "spv-out", "wgsl-out"]}
rayon = "1.5"
rayon.workspace = true
2 changes: 1 addition & 1 deletion code/showcase/gifs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2018"

[dependencies]
anyhow.workspace = true
bytemuck = { version = "1.13", features = ["derive"] }
bytemuck = { version = "1.14", features = ["derive"] }
glam.workspace = true
env_logger = "0.10"
pollster = "0.3"
Expand Down
4 changes: 2 additions & 2 deletions code/showcase/pong/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
cfg-if = "1"
env_logger.workspace = true
winit = "0.28"
winit = "0.28.7"
anyhow.workspace = true
bytemuck = { workspace = true, features = ["derive"] }
cgmath = "0.18"
Expand Down Expand Up @@ -39,6 +39,6 @@ wgpu = { version = "0.16", features = ["spirv", "webgl"] }
anyhow.workspace = true
fs_extra.workspace = true
glob.workspace = true
rayon = "1.4"
rayon.workspace = true
# naga 的接口有变化,用新版本得修改 build.rs
naga = { version = "0.11", features = ["glsl-in", "spv-out", "wgsl-out"] }
2 changes: 1 addition & 1 deletion code/showcase/threading/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ glam.workspace = true
env_logger.workspace = true
pollster.workspace = true
log = "0.4"
rayon = "1.4" # NEW!
rayon.workspace = true
tobj = { version = "3.2", features = ["async"] }
wgpu.workspace = true
winit.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions docs/beginner/tutorial1-window.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

```toml
[dependencies]
winit = "0.27.5"
winit = "0.28.7"
env_logger = "0.10"
log = "0.4"
wgpu = "0.17"
Expand Down Expand Up @@ -118,7 +118,7 @@ cfg-if = "1"

[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1.7"
console_log = "0.2.0"
console_log = "1.0"
wasm-bindgen = "0.2.87"
wasm-bindgen-futures = "0.4.34"
web-sys = { version = "0.3.64", features = [
Expand Down
4 changes: 2 additions & 2 deletions docs/beginner/tutorial2-surface/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,15 @@ WASM 环境中不能在异步函数里使用 `block_on`。`Future`(异步函
```toml
[dependencies]
cfg-if = "1"
winit = "0.27.5"
winit = "0.28.7"
env_logger = "0.10"
log = "0.4"
wgpu = "0.17"
pollster = "0.3"

[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1.7"
console_log = "0.2.0"
console_log = "1.0"
wasm-bindgen = "0.2.87"
wasm-bindgen-futures = "0.4.34"
web-sys = { version = "0.3.64", features = [
Expand Down
2 changes: 1 addition & 1 deletion docs/beginner/tutorial4-buffer/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ use wgpu::util::DeviceExt;
你应该注意到我们使用了 [bytemuck](https://docs.rs/bytemuck/1.2.0/bytemuck/) 来将 `VERTICES` 转换为 `&[u8]``create_buffer_init()` 函数的参数类型是 `&[u8]`,而 `bytemuck::cast_slice` 为我们实现了此类型转换。为此需在 `Cargo.toml` 中添加以下依赖项:

```toml
bytemuck = { version = "1.13", features = [ "derive" ] }
bytemuck = { version = "1.14", features = [ "derive" ] }
```

我们还需要实现两个 trait 来使 `bytemuck` 工作。它们是 [bytemuck::Pod](https://docs.rs/bytemuck/1.3.0/bytemuck/trait.Pod.html)[bytemuck::Zeroable](https://docs.rs/bytemuck/1.3.0/bytemuck/trait.Zeroable.html)`Pod` 表示 `Vertex`["Plain Old Data"](<https://zh.wikipedia.org/wiki/POD_(程序设计)>) 数据类型,因此可以被解释为 `&[u8]` 类型。`Zeroable` 表示可以对其使用 `std::mem::zeroed()`。下面修改 `Vertex` 结构体来派生这些 trait:
Expand Down
4 changes: 2 additions & 2 deletions docs/beginner/tutorial5-textures/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,12 +433,12 @@ const VERTICES: &[Vertex] = &[
[dependencies]
image = "0.23"
glam = "0.24"
winit = "0.27.5"
winit = "0.28.7"
env_logger = "0.10"
log = "0.4"
pollster = "0.3"
wgpu = "0.17"
bytemuck = { version = "1.13", features = [ "derive" ] }
bytemuck = { version = "1.14", features = [ "derive" ] }
anyhow = "1.0" # NEW!
```

Expand Down
2 changes: 1 addition & 1 deletion docs/beginner/tutorial9-models/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ fn main() -> Result<()> {
```toml
[build-dependencies]
anyhow = "1.0"
fs_extra = "1.2"
fs_extra = "1.3"
glob = "0.3"
```

Expand Down
8 changes: 4 additions & 4 deletions docs/showcase/pong/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ In order for wasm-pack to work properly I first needed to add some dependencies:
[dependencies]
cfg-if = "1"
env_logger = "0.10"
winit = "0.28"
winit = "0.28.7"
anyhow = "1.0"
bytemuck = { version = "1.12", features = [ "derive" ] }
bytemuck = { version = "1.14", features = [ "derive" ] }
cgmath = "0.18"
pollster = "0.3"
wgpu = { version = "0.16", features = ["spirv"]}
Expand All @@ -292,9 +292,9 @@ wgpu = { version = "0.16", features = ["spirv", "webgl"]}

[build-dependencies]
anyhow = "1.0"
fs_extra = "1.2"
fs_extra = "1.3"
glob = "0.3"
rayon = "1.4"
rayon = "1.8"
naga = { version = "0.11", features = ["glsl-in", "spv-out", "wgsl-out"]}

```
Expand Down

0 comments on commit f275f22

Please sign in to comment.