mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 22:11:01 +01:00
ExternalTexture::{as, from}_core
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
1 parent
03b55c403a
commit
f7ae2007a0
2 files changed
+33
No files matched your search
@@ -27,6 +27,27 @@ impl ExternalTexture {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(wgpu_core)]
|
||||
impl ExternalTexture {
|
||||
/// Create a new external texture of wgpu from a wgpu-core external texture.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// - `core_external_texture` - wgpu-core external texture.
|
||||
pub fn from_core(
|
||||
core_external_texture: alloc::sync::Arc<wgc::resource::ExternalTexture>,
|
||||
) -> Self {
|
||||
Self {
|
||||
inner: crate::backend::wgpu_core::CoreExternalTexture::from_core(core_external_texture)
|
||||
.into(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the underlying wgpu-core external texture if this `ExternalTexture` is on the wgpu-core backend, otherwise `None`.
|
||||
pub fn as_core(&self) -> Option<alloc::sync::Arc<wgc::resource::ExternalTexture>> {
|
||||
self.inner.as_core_opt().map(|et| et.as_core())
|
||||
}
|
||||
}
|
||||
/// Describes an [`ExternalTexture`].
|
||||
///
|
||||
/// For use with [`Device::create_external_texture`].
|
||||
|
||||
@@ -409,6 +409,18 @@ pub struct CoreExternalTexture {
|
||||
pub(crate) wgpu_external_texture: Arc<wgc::resource::ExternalTexture>,
|
||||
}
|
||||
|
||||
impl CoreExternalTexture {
|
||||
pub(crate) fn from_core(core_external_texture: Arc<wgc::resource::ExternalTexture>) -> Self {
|
||||
Self {
|
||||
wgpu_external_texture: core_external_texture,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn as_core(&self) -> Arc<wgc::resource::ExternalTexture> {
|
||||
self.wgpu_external_texture.clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CoreSampler {
|
||||
pub(crate) wgpu_sampler: Arc<wgc::resource::Sampler>,
|
||||
|
||||
Reference in new issue
Block a user