diff --git a/Cargo.lock b/Cargo.lock index 5c781ca2a4..f869263ce8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -353,7 +353,7 @@ dependencies = [ "bitflags 2.8.0", "cexpr", "clang-sys", - "itertools 0.13.0", + "itertools 0.10.5", "log", "prettyplease", "proc-macro2", @@ -1305,7 +1305,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2004,7 +2004,7 @@ checksum = "e19b23d53f35ce9f56aebc7d1bb4e6ac1e9c0db7ac85c8d1760c04379edced37" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2134,7 +2134,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -2180,7 +2180,7 @@ checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" [[package]] name = "lock-analyzer" -version = "24.0.0" +version = "24.0.1" dependencies = [ "anyhow", "ron", @@ -2967,7 +2967,7 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "player" -version = "24.0.0" +version = "24.0.1" dependencies = [ "env_logger", "log", @@ -3334,7 +3334,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4003,7 +4003,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69fff37da548239c3bf9e64a12193d261e8b22b660991c6fd2df057c168f435f" dependencies = [ "cc", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -4494,7 +4494,7 @@ dependencies = [ [[package]] name = "wgpu" -version = "24.0.0" +version = "24.0.1" dependencies = [ "arrayvec", "bitflags 2.8.0", @@ -4520,7 +4520,7 @@ dependencies = [ [[package]] name = "wgpu-benchmark" -version = "24.0.0" +version = "24.0.1" dependencies = [ "bincode", "bytemuck", @@ -4583,7 +4583,7 @@ dependencies = [ [[package]] name = "wgpu-examples" -version = "24.0.0" +version = "24.0.1" dependencies = [ "bytemuck", "cfg-if", @@ -4667,7 +4667,7 @@ dependencies = [ [[package]] name = "wgpu-info" -version = "24.0.0" +version = "24.0.1" dependencies = [ "anyhow", "bitflags 2.8.0", @@ -4681,7 +4681,7 @@ dependencies = [ [[package]] name = "wgpu-macros" -version = "24.0.0" +version = "24.0.1" dependencies = [ "heck 0.5.0", "quote", @@ -4690,7 +4690,7 @@ dependencies = [ [[package]] name = "wgpu-test" -version = "24.0.0" +version = "24.0.1" dependencies = [ "anyhow", "approx", @@ -4772,7 +4772,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 926d3bd53b..9a46380f10 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,7 +54,7 @@ keywords = ["graphics"] license = "MIT OR Apache-2.0" homepage = "https://wgpu.rs/" repository = "https://github.com/gfx-rs/wgpu" -version = "24.0.0" +version = "24.0.1" authors = ["gfx-rs developers"] [workspace.dependencies] diff --git a/wgpu-hal/src/metal/mod.rs b/wgpu-hal/src/metal/mod.rs index f412d68cf2..b6c3991a49 100644 --- a/wgpu-hal/src/metal/mod.rs +++ b/wgpu-hal/src/metal/mod.rs @@ -356,6 +356,10 @@ impl Queue { timestamp_period, } } + + pub fn as_raw(&self) -> parking_lot::MutexGuard<'_, metal::CommandQueue> { + self.raw.lock() + } } pub struct Device { diff --git a/wgpu/src/api/queue.rs b/wgpu/src/api/queue.rs index 8442f2aae1..e922a5a47b 100644 --- a/wgpu/src/api/queue.rs +++ b/wgpu/src/api/queue.rs @@ -251,4 +251,26 @@ impl Queue { pub fn on_submitted_work_done(&self, callback: impl FnOnce() + Send + 'static) { self.inner.on_submitted_work_done(Box::new(callback)); } + + /// Returns the inner hal Queue using a callback. The hal queue will be `None` if the + /// backend type argument does not match with this wgpu Queue + /// + /// # Safety + /// + /// - The raw handle obtained from the hal Queue must not be manually destroyed + #[cfg(wgpu_core)] + pub unsafe fn as_hal) -> R, R>( + &self, + hal_queue_callback: F, + ) -> R { + if let Some(core_queue) = self.inner.as_core_opt() { + unsafe { + core_queue + .context + .queue_as_hal::(core_queue, hal_queue_callback) + } + } else { + hal_queue_callback(None) + } + } } diff --git a/wgpu/src/backend/wgpu_core.rs b/wgpu/src/backend/wgpu_core.rs index 98463cbcdd..ed0bd8a3e7 100644 --- a/wgpu/src/backend/wgpu_core.rs +++ b/wgpu/src/backend/wgpu_core.rs @@ -360,6 +360,14 @@ impl ContextWgpuCore { format!("Validation Error\n\nCaused by:\n{output}") } + + pub unsafe fn queue_as_hal) -> R, R>( + &self, + queue: &CoreQueue, + hal_queue_callback: F, + ) -> R { + unsafe { self.0.queue_as_hal::(queue.id, hal_queue_callback) } + } } fn map_buffer_copy_view(view: crate::TexelCopyBufferInfo<'_>) -> wgc::command::TexelCopyBufferInfo {