wgpu/api/
external_texture.rs1use crate::*;
2
3#[derive(Debug, Clone)]
9pub struct ExternalTexture {
10 pub(crate) inner: dispatch::DispatchExternalTexture,
11}
12#[cfg(send_sync)]
13static_assertions::assert_impl_all!(ExternalTexture: Send, Sync);
14
15crate::cmp::impl_eq_ord_hash_proxy!(ExternalTexture => .inner);
16
17impl ExternalTexture {
18 pub fn destroy(&self) {
20 self.inner.destroy();
21 }
22
23 #[cfg(custom)]
25 pub fn as_custom<T: custom::ExternalTextureInterface>(&self) -> Option<&T> {
26 self.inner.as_custom()
27 }
28}
29
30#[cfg(wgpu_core)]
31impl ExternalTexture {
32 pub fn from_core(
38 core_external_texture: alloc::sync::Arc<wgc::resource::ExternalTexture>,
39 ) -> Self {
40 Self {
41 inner: crate::backend::wgpu_core::CoreExternalTexture::from_core(core_external_texture)
42 .into(),
43 }
44 }
45
46 pub fn as_core(&self) -> Option<alloc::sync::Arc<wgc::resource::ExternalTexture>> {
48 self.inner.as_core_opt().map(|et| et.as_core())
49 }
50}
51pub type ExternalTextureDescriptor<'a> = wgt::ExternalTextureDescriptor<Label<'a>>;
58static_assertions::assert_impl_all!(ExternalTextureDescriptor<'_>: Send, Sync);