Queue::{as, from}_core

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
sagudev authored and mergify[bot] committed 2026-09-27 06:46:29 +00:00
1 parent ef4d18d4b2
commit 7dad9fe416
2 files changed
+29

No files matched your search

+19
View File
@@ -396,3 +396,22 @@ impl Queue {
}
}
}
#[cfg(wgpu_core)]
impl Queue {
/// Create a new queue of wgpu from a wgpu-core queue.
///
/// # Arguments
///
/// - `core_queue` - wgpu-core queue.
pub fn from_core(core_queue: alloc::sync::Arc<wgc::device::queue::Queue>) -> Self {
Self {
inner: crate::backend::wgpu_core::CoreQueue::from_core(core_queue).into(),
}
}
/// Returns the underlying wgpu-core queue if this `Queue` is on the wgpu-core backend, otherwise `None`.
pub fn as_core(&self) -> Option<alloc::sync::Arc<wgc::device::queue::Queue>> {
self.inner.as_core_opt().map(|cq| cq.as_core())
}
}
+10
View File
@@ -406,6 +406,16 @@ impl CoreQueue {
) -> Option<impl Deref<Target = A::Queue> + WasmNotSendSync> {
unsafe { self.wgpu_queue.clone().as_hal::<A>() }
}
pub(crate) fn from_core(core_queue: Arc<wgc::device::queue::Queue>) -> Self {
Self {
wgpu_queue: core_queue,
}
}
pub(crate) fn as_core(&self) -> Arc<wgc::device::queue::Queue> {
self.wgpu_queue.clone()
}
}
#[derive(Debug, Clone)]