mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-30 10:03:58 +01:00
Queue::{as, from}_core
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
1 parent
ef4d18d4b2
commit
7dad9fe416
2 files changed
+29
No files matched your search
@@ -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())
|
||||
}
|
||||
}
|
||||
@@ -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)]
|
||||
|
||||
Reference in new issue
Block a user