pub struct ScratchTexture { /* private fields */ }Expand description
A pooled texture. Work recorded after it is dropped may reuse it, so keep it until all work that uses its contents is recorded.
Returned textures share a 64 MiB idle-cache budget. Active leases are never evicted; oversized textures are released rather than cached when dropped.
Implementations§
Methods from Deref<Target = TextureView>§
pub fn texture(&self) -> &Texture
pub fn texture(&self) -> &Texture
Returns the [Texture] that this TextureView refers to.
All wgpu resources are refcounted, so you can own the returned [Texture]
by cloning it.
pub unsafe fn as_hal<A>(
&self,
) -> Option<impl Deref<Target = <A as Api>::TextureView>>where
A: Api,
pub unsafe fn as_hal<A>(
&self,
) -> Option<impl Deref<Target = <A as Api>::TextureView>>where
A: Api,
Get the [wgpu_hal] texture view from this TextureView.
Find the Api struct corresponding to the active backend in [wgpu_hal::api],
and pass that struct to the to the A type parameter.
Returns a guard that dereferences to the type of the hal backend
which implements A::TextureView.
§Types
The returned type depends on the backend:
- [
hal::api::Vulkan] uses [hal::vulkan::TextureView] hal::api::Metaluseshal::metal::TextureViewhal::api::Dx12useshal::dx12::TextureView- [
hal::api::Gles] uses [hal::gles::TextureView]
§Deadlocks
- The returned guard holds a read-lock on a device-local “destruction”
lock, which will cause all calls to
destroyto block until the guard is released.
§Errors
This method will return None if:
- The texture view is not from the backend specified by
A. - The texture view is from [
Backend::BrowserWebGpu]. (UseTextureView::as_webgpu()instead.) - The texture view is from a custom backend.
§Safety
- The returned resource must not be destroyed unless the guard is the last reference to it and it is not in use by the GPU. The guard and handle may be dropped at any time however.
- All the safety requirements of wgpu-hal must be upheld.
Trait Implementations§
Source§impl Deref for ScratchTexture
impl Deref for ScratchTexture
Source§impl Drop for ScratchTexture
impl Drop for ScratchTexture
Auto Trait Implementations§
impl !RefUnwindSafe for ScratchTexture
impl !UnwindSafe for ScratchTexture
impl Freeze for ScratchTexture
impl Send for ScratchTexture
impl Sync for ScratchTexture
impl Unpin for ScratchTexture
impl UnsafeUnpin for ScratchTexture
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.