wgpu/api/external_texture.rs
1use crate::*;
2
3/// Handle to an external texture on the GPU.
4///
5/// It can be created with [`Device::create_external_texture`].
6///
7/// Corresponds to [WebGPU `GPUExternalTexture`](https://gpuweb.github.io/gpuweb/#gpuexternaltexture).
8#[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 /// Destroy the associated native resources as soon as possible.
19 pub fn destroy(&self) {
20 self.inner.destroy();
21 }
22}
23
24/// Describes an [`ExternalTexture`].
25///
26/// For use with [`Device::create_external_texture`].
27///
28/// Corresponds to [WebGPU `GPUExternalTextureDescriptor`](
29/// https://gpuweb.github.io/gpuweb/#dictdef-gpuexternaltexturedescriptor).
30pub type ExternalTextureDescriptor<'a> = wgt::ExternalTextureDescriptor<Label<'a>>;
31static_assertions::assert_impl_all!(ExternalTextureDescriptor<'_>: Send, Sync);