pub struct Texture {
pub texture: Texture,
pub view: TextureView,
}Fields§
§texture: Texture§view: TextureViewMethods from Deref<Target = Texture>§
pub unsafe fn as_hal<A>(
&self,
) -> Option<impl Deref<Target = <A as Api>::Texture>>where
A: HalApi,
pub unsafe fn as_hal<A>(
&self,
) -> Option<impl Deref<Target = <A as Api>::Texture>>where
A: HalApi,
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.
§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§
Source§impl MewTexture for Texture
impl MewTexture for Texture
fn new(texture: Texture) -> Self
fn binding_type() -> BindingType
fn buffer_desc( inner_size: (u32, u32, u32), format: TextureFormat, ) -> TextureDescriptor<'static>
fn as_binding<'a>(&'a self) -> BindingResource<'a>
fn as_colour_attachment<'a>( &'a self, clear: Option<Color>, depth_slice: Option<u32>, ) -> RenderPassColorAttachment<'a>
fn as_depth_attachment<'a>(&'a self) -> RenderPassDepthStencilAttachment<'a>
fn memory_estimate(&self) -> u64
fn texel_layout(&self) -> TexelCopyBufferLayout
Source§impl Ord for Texture
impl Ord for Texture
Source§impl PartialOrd for Texture
impl PartialOrd for Texture
impl Eq for Texture
impl StructuralPartialEq for Texture
Auto Trait Implementations§
impl Freeze for Texture
impl !RefUnwindSafe for Texture
impl Send for Texture
impl Sync for Texture
impl Unpin for Texture
impl !UnwindSafe for Texture
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§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> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.