From f286882924eb66b678b1048c48d32417d6210fc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Mockers?= Date: Fri, 15 Nov 2024 09:18:11 +0100 Subject: [PATCH 1/5] Fix iOS crash: don't set autoresizing mask (#6535) --- CHANGELOG.md | 8 ++++++++ wgpu-hal/src/metal/surface.rs | 38 ++++++++++++++++++----------------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef4548fa31..e3d17fd52d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,14 @@ Bottom level categories: ## Unreleased +## 23.1.0 (2024-11-??) + +### Bug fixes + +#### Metal + +- Fix surface creation crashing on iOS. By @mockersf in [#6535](https://github.com/gfx-rs/wgpu/pull/6535) + ## 23.0.0 (2024-10-25) ### Themes of this release diff --git a/wgpu-hal/src/metal/surface.rs b/wgpu-hal/src/metal/surface.rs index 668b602474..b35c73c910 100644 --- a/wgpu-hal/src/metal/surface.rs +++ b/wgpu-hal/src/metal/surface.rs @@ -1,6 +1,5 @@ #![allow(clippy::let_unit_value)] // `let () =` being used to constrain result type -use std::ffi::c_uint; use std::mem::ManuallyDrop; use std::ptr::NonNull; use std::sync::Once; @@ -207,23 +206,26 @@ impl super::Surface { let new_layer: *mut Object = msg_send![class!(CAMetalLayer), new]; let () = msg_send![root_layer, addSublayer: new_layer]; - // Automatically resize the sublayer's frame to match the - // superlayer's bounds. - // - // Note that there is a somewhat hidden design decision in this: - // We define the `width` and `height` in `configure` to control - // the `drawableSize` of the layer, while `bounds` and `frame` are - // outside of the user's direct control - instead, though, they - // can control the size of the view (or root layer), and get the - // desired effect that way. - // - // We _could_ also let `configure` set the `bounds` size, however - // that would be inconsistent with using the root layer directly - // (as we may do, see above). - let width_sizable = 1 << 1; // kCALayerWidthSizable - let height_sizable = 1 << 4; // kCALayerHeightSizable - let mask: c_uint = width_sizable | height_sizable; - let () = msg_send![new_layer, setAutoresizingMask: mask]; + #[cfg(target_os = "macos")] + { + // Automatically resize the sublayer's frame to match the + // superlayer's bounds. + // + // Note that there is a somewhat hidden design decision in this: + // We define the `width` and `height` in `configure` to control + // the `drawableSize` of the layer, while `bounds` and `frame` are + // outside of the user's direct control - instead, though, they + // can control the size of the view (or root layer), and get the + // desired effect that way. + // + // We _could_ also let `configure` set the `bounds` size, however + // that would be inconsistent with using the root layer directly + // (as we may do, see above). + let width_sizable = 1 << 1; // kCALayerWidthSizable + let height_sizable = 1 << 4; // kCALayerHeightSizable + let mask: std::ffi::c_uint = width_sizable | height_sizable; + let () = msg_send![new_layer, setAutoresizingMask: mask]; + } // Specify the relative size that the auto resizing mask above // will keep (i.e. tell it to fill out its superlayer). From 5ea728898827dad2ecb83cf9256092272c4aa723 Mon Sep 17 00:00:00 2001 From: Xiaopeng Li Date: Thu, 21 Nov 2024 17:47:05 +0800 Subject: [PATCH 2/5] Fix leaks of WeakVec (#6576) --- CHANGELOG.md | 5 +++++ wgpu-core/src/weak_vec.rs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3d17fd52d..2df3b470e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,11 @@ Bottom level categories: ### Bug fixes + +#### General + +- Fix Texture view leaks regression. By @xiaopengli89 in [#6576](https://github.com/gfx-rs/wgpu/pull/6576) + #### Metal - Fix surface creation crashing on iOS. By @mockersf in [#6535](https://github.com/gfx-rs/wgpu/pull/6535) diff --git a/wgpu-core/src/weak_vec.rs b/wgpu-core/src/weak_vec.rs index b645cc714d..f6034c6e90 100644 --- a/wgpu-core/src/weak_vec.rs +++ b/wgpu-core/src/weak_vec.rs @@ -47,7 +47,7 @@ impl WeakVec { } if let Some(i) = self.empty_slots.pop() { self.inner[i] = Some(value); - self.scan_slots_on_next_push = false; + self.scan_slots_on_next_push = self.empty_slots.is_empty(); } else { self.inner.push(Some(value)); self.scan_slots_on_next_push = self.inner.len() == self.inner.capacity(); From 1f49837cb0ea8e8e17aecf454029feb15c6c35b2 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Tue, 12 Nov 2024 23:51:07 +0100 Subject: [PATCH 3/5] Fix Vulkan surface capabilities being advertised when its query failed. (#6510) Leaves out portions of #6510 that changed the interface --- CHANGELOG.md | 4 ++++ wgpu-hal/src/vulkan/adapter.rs | 6 ++++-- wgpu/src/backend/wgpu_core.rs | 5 +---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2df3b470e5..d0104b363c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,10 @@ Bottom level categories: - Fix surface creation crashing on iOS. By @mockersf in [#6535](https://github.com/gfx-rs/wgpu/pull/6535) +#### Vulkan + +- Fix surface capabilities being advertised when its query failed. By @wumpf in [#6510](https://github.com/gfx-rs/wgpu/pull/6510) + ## 23.0.0 (2024-10-25) ### Themes of this release diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index 6d15492f4c..14fd86a5da 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -2254,7 +2254,8 @@ impl crate::Adapter for super::Adapter { Ok(present_modes) => present_modes, Err(e) => { log::error!("get_physical_device_surface_present_modes: {}", e); - Vec::new() + // Per definition of `SurfaceCapabilities`, there must be at least one present mode. + return None; } } }; @@ -2269,7 +2270,8 @@ impl crate::Adapter for super::Adapter { Ok(formats) => formats, Err(e) => { log::error!("get_physical_device_surface_formats: {}", e); - Vec::new() + // Per definition of `SurfaceCapabilities`, there must be at least one present format. + return None; } } }; diff --git a/wgpu/src/backend/wgpu_core.rs b/wgpu/src/backend/wgpu_core.rs index 652df388ff..ff84b5b683 100644 --- a/wgpu/src/backend/wgpu_core.rs +++ b/wgpu/src/backend/wgpu_core.rs @@ -702,10 +702,7 @@ impl crate::Context for ContextWgpuCore { .surface_get_capabilities(surface_data.id, *adapter_data) { Ok(caps) => caps, - Err(wgc::instance::GetSurfaceSupportError::Unsupported) => { - wgt::SurfaceCapabilities::default() - } - Err(err) => self.handle_error_fatal(err, "Surface::get_supported_formats"), + Err(_) => wgt::SurfaceCapabilities::default(), } } From 1755db74a4525e3f4c7b519f4782eaf8e9f90469 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Sun, 24 Nov 2024 11:35:04 +0100 Subject: [PATCH 4/5] bump wgpu, wgpu-core, wgpu-hal to 23.0.1 --- CHANGELOG.md | 6 ++++-- Cargo.lock | 20 ++++++++++---------- Cargo.toml | 10 +++++----- wgpu-core/Cargo.toml | 2 +- wgpu-hal/Cargo.toml | 2 +- 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0104b363c..a23c53d25f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,10 +40,12 @@ Bottom level categories: ## Unreleased -## 23.1.0 (2024-11-??) +## 23.0.1 (2024-11-24) -### Bug fixes +This release includes `wgpu`, `wgpu-core` and `wgpu-hal`. All other crates remain at 23.0.0. +Below changes were cherry-picked from 23.0.0. +### Bug fixes #### General diff --git a/Cargo.lock b/Cargo.lock index 8ab3d854b5..97dcaed7f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1739,7 +1739,7 @@ checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" [[package]] name = "lock-analyzer" -version = "23.0.0" +version = "23.0.1" dependencies = [ "anyhow", "ron", @@ -2271,7 +2271,7 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "player" -version = "23.0.0" +version = "23.0.1" dependencies = [ "env_logger", "log", @@ -3564,7 +3564,7 @@ dependencies = [ [[package]] name = "wgpu" -version = "23.0.0" +version = "23.0.1" dependencies = [ "arrayvec", "cfg_aliases", @@ -3588,7 +3588,7 @@ dependencies = [ [[package]] name = "wgpu-benchmark" -version = "23.0.0" +version = "23.0.1" dependencies = [ "bincode", "bytemuck", @@ -3605,7 +3605,7 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "23.0.0" +version = "23.0.1" dependencies = [ "arrayvec", "bit-vec", @@ -3631,7 +3631,7 @@ dependencies = [ [[package]] name = "wgpu-examples" -version = "23.0.0" +version = "23.0.1" dependencies = [ "bytemuck", "cfg-if", @@ -3662,7 +3662,7 @@ dependencies = [ [[package]] name = "wgpu-hal" -version = "23.0.0" +version = "23.0.1" dependencies = [ "android_system_properties", "arrayvec", @@ -3712,7 +3712,7 @@ dependencies = [ [[package]] name = "wgpu-info" -version = "23.0.0" +version = "23.0.1" dependencies = [ "anyhow", "bitflags 2.6.0", @@ -3725,7 +3725,7 @@ dependencies = [ [[package]] name = "wgpu-macros" -version = "23.0.0" +version = "23.0.1" dependencies = [ "heck 0.5.0", "quote", @@ -3734,7 +3734,7 @@ dependencies = [ [[package]] name = "wgpu-test" -version = "23.0.0" +version = "23.0.1" dependencies = [ "anyhow", "arrayvec", diff --git a/Cargo.toml b/Cargo.toml index 0a5481abfd..96c6a123d8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,13 +47,13 @@ keywords = ["graphics"] license = "MIT OR Apache-2.0" homepage = "https://wgpu.rs/" repository = "https://github.com/gfx-rs/wgpu" -version = "23.0.0" +version = "23.0.1" authors = ["gfx-rs developers"] [workspace.dependencies.wgc] package = "wgpu-core" path = "./wgpu-core" -version = "23.0.0" +version = "23.0.1" [workspace.dependencies.wgt] package = "wgpu-types" @@ -63,7 +63,7 @@ version = "23.0.0" [workspace.dependencies.hal] package = "wgpu-hal" path = "./wgpu-hal" -version = "23.0.0" +version = "23.0.1" [workspace.dependencies.naga] path = "./naga" @@ -126,8 +126,8 @@ static_assertions = "1.1.0" strum = { version = "0.25.0", features = ["derive"] } tracy-client = "0.17" thiserror = "1.0.65" -wgpu = { version = "23.0.0", path = "./wgpu", default-features = false } -wgpu-core = { version = "23.0.0", path = "./wgpu-core" } +wgpu = { version = "23.0.1", path = "./wgpu", default-features = false } +wgpu-core = { version = "23.0.1", path = "./wgpu-core" } wgpu-macros = { version = "23.0.0", path = "./wgpu-macros" } wgpu-test = { version = "23.0.0", path = "./tests" } wgpu-types = { version = "23.0.0", path = "./wgpu-types" } diff --git a/wgpu-core/Cargo.toml b/wgpu-core/Cargo.toml index 5906aeb339..34bb25fc87 100644 --- a/wgpu-core/Cargo.toml +++ b/wgpu-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wgpu-core" -version = "23.0.0" +version = "23.0.1" authors = ["gfx-rs developers"] edition = "2021" description = "WebGPU core logic on wgpu-hal" diff --git a/wgpu-hal/Cargo.toml b/wgpu-hal/Cargo.toml index 35e85f45da..e4a2943af1 100644 --- a/wgpu-hal/Cargo.toml +++ b/wgpu-hal/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wgpu-hal" -version = "23.0.0" +version = "23.0.1" authors = ["gfx-rs developers"] edition = "2021" description = "WebGPU hardware abstraction layer" From cbe98e648ecb4f25a0d8af284f294b8c0f6f0462 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Mon, 25 Nov 2024 09:02:17 +0100 Subject: [PATCH 5/5] Updates to v23.0.1 changelog notes - fix date & links --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a23c53d25f..0f81b26bf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,10 +40,10 @@ Bottom level categories: ## Unreleased -## 23.0.1 (2024-11-24) +## 23.0.1 (2024-11-25) -This release includes `wgpu`, `wgpu-core` and `wgpu-hal`. All other crates remain at 23.0.0. -Below changes were cherry-picked from 23.0.0. +This release includes patches for `wgpu`, `wgpu-core` and `wgpu-hal`. All other crates remain at [23.0.0](https://github.com/gfx-rs/wgpu/releases/tag/v23.0.0). +Below changes were cherry-picked from 24.0.0 development line. ### Bug fixes