pub struct WgpuTexture {
inner: Texture,
}Fields§
§inner: TextureImplementations§
Source§impl WgpuTexture
impl WgpuTexture
pub fn new(ctx: &WgpuContext, desc: &TextureDescriptor<'_>) -> Self
Methods from Deref<Target = Texture>§
pub unsafe fn as_hal<A>(
&self,
) -> Option<impl Deref<Target = <A as Api>::Texture>>where
A: Api,
Available on wgpu_core only.
pub unsafe fn as_hal<A>(
&self,
) -> Option<impl Deref<Target = <A as Api>::Texture>>where
A: Api,
wgpu_core only.Get the [wgpu_hal] texture from this Texture.
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::Texture.
§Types
The returned type depends on the backend:
- [
hal::api::Vulkan] uses [hal::vulkan::Texture] hal::api::Metaluseshal::metal::Texturehal::api::Dx12useshal::dx12::Texture- [
hal::api::Gles] uses [hal::gles::Texture]
§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 is not from the backend specified by
A. - The texture is from the
webgpuorcustombackend. - The texture has had [
Self::destroy()] called on it.
§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.
pub fn create_view(
&self,
desc: &TextureViewDescriptor<Option<&str>>,
) -> TextureView
pub fn create_view( &self, desc: &TextureViewDescriptor<Option<&str>>, ) -> TextureView
Creates a view of this texture, specifying an interpretation of its texels and possibly a subset of its layers and mip levels.
Texture views are needed to use a texture as a binding in a [BindGroup]
or as an attachment in a [RenderPass].
pub fn destroy(&self)
pub fn destroy(&self)
Destroy the associated native resources as soon as possible.
pub fn as_image_copy(&self) -> TexelCopyTextureInfo<&Texture>
pub fn as_image_copy(&self) -> TexelCopyTextureInfo<&Texture>
Make an TexelCopyTextureInfo representing the whole texture.
pub fn size(&self) -> Extent3d
pub fn size(&self) -> Extent3d
Returns the size of this Texture.
This is always equal to the size that was specified when creating the texture.
pub fn width(&self) -> u32
pub fn width(&self) -> u32
Returns the width of this Texture.
This is always equal to the size.width that was specified when creating the texture.
pub fn height(&self) -> u32
pub fn height(&self) -> u32
Returns the height of this Texture.
This is always equal to the size.height that was specified when creating the texture.
pub fn depth_or_array_layers(&self) -> u32
pub fn depth_or_array_layers(&self) -> u32
Returns the depth or layer count of this Texture.
This is always equal to the size.depth_or_array_layers that was specified when creating the texture.
pub fn mip_level_count(&self) -> u32
pub fn mip_level_count(&self) -> u32
Returns the mip_level_count of this Texture.
This is always equal to the mip_level_count that was specified when creating the texture.
pub fn sample_count(&self) -> u32
pub fn sample_count(&self) -> u32
Returns the sample_count of this Texture.
This is always equal to the sample_count that was specified when creating the texture.
pub fn dimension(&self) -> TextureDimension
pub fn dimension(&self) -> TextureDimension
Returns the dimension of this Texture.
This is always equal to the dimension that was specified when creating the texture.
pub fn format(&self) -> TextureFormat
pub fn format(&self) -> TextureFormat
Returns the format of this Texture.
This is always equal to the format that was specified when creating the texture.
pub fn usage(&self) -> TextureUsages
pub fn usage(&self) -> TextureUsages
Returns the allowed usages of this Texture.
This is always equal to the usage that was specified when creating the texture.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WgpuTexture
impl !RefUnwindSafe for WgpuTexture
impl Send for WgpuTexture
impl Sync for WgpuTexture
impl Unpin for WgpuTexture
impl !UnwindSafe for WgpuTexture
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more