mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-21 23:11:01 +01:00
Adapter::{as, from}_core
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
1 parent
7014d48757
commit
89cac1d785
2 files changed
+31
No files matched your search
@@ -216,3 +216,24 @@ impl Adapter {
|
||||
self.inner.cooperative_matrix_properties()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(wgpu_core)]
|
||||
impl Adapter {
|
||||
/// Create a new adapter of wgpu from a wgpu-core adapter.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// - `core_adapter` - wgpu-core adapter.
|
||||
pub fn from_core(core_adapter: alloc::sync::Arc<wgc::instance::Adapter>) -> Self {
|
||||
Self {
|
||||
inner: crate::backend::wgpu_core::CoreAdapter::from_core(core_adapter).into(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the [`wgpu_core`] adapter from this `Adapter`.
|
||||
///
|
||||
/// Returns `None` if the adapter is not from the `wgpu_core` backend
|
||||
pub fn as_core(&self) -> Option<alloc::sync::Arc<wgc::instance::Adapter>> {
|
||||
self.inner.as_core_opt().map(|adapter| adapter.as_core())
|
||||
}
|
||||
}
|
||||
@@ -204,6 +204,16 @@ impl CoreAdapter {
|
||||
let queue = CoreQueue { wgpu_queue: queue };
|
||||
Ok((device, queue))
|
||||
}
|
||||
|
||||
pub(crate) fn from_core(core_adapter: Arc<wgc::instance::Adapter>) -> Self {
|
||||
Self {
|
||||
wgpu_adapter: core_adapter,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn as_core(&self) -> Arc<wgc::instance::Adapter> {
|
||||
self.wgpu_adapter.clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
||||
Reference in new issue
Block a user