pub struct Texture { /* private fields */ }
Expand description
Handle to a texture on the GPU.
It can be created with Device::create_texture
.
Corresponds to WebGPU GPUTexture
.
Implementations§
source§impl Texture
impl Texture
sourcepub unsafe fn as_hal<A: HalApi, F: FnOnce(Option<&A::Texture>) -> R, R>(
&self,
hal_texture_callback: F
) -> R
Available on wgpu_core
only.
pub unsafe fn as_hal<A: HalApi, F: FnOnce(Option<&A::Texture>) -> R, R>( &self, hal_texture_callback: F ) -> R
wgpu_core
only.Returns the inner hal Texture using a callback. The hal texture will be None
if the
backend type argument does not match with this wgpu Texture
Safety
- The raw handle obtained from the hal Texture must not be manually destroyed
sourcepub fn create_view(&self, desc: &TextureViewDescriptor<'_>) -> TextureView
pub fn create_view(&self, desc: &TextureViewDescriptor<'_>) -> TextureView
Creates a view of this texture.
sourcepub fn as_image_copy(&self) -> TexelCopyTextureInfo<'_>
pub fn as_image_copy(&self) -> TexelCopyTextureInfo<'_>
Make an TexelCopyTextureInfo
representing the whole texture.
sourcepub 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.
sourcepub 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.
sourcepub 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.
sourcepub 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.
sourcepub 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.
sourcepub 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.
sourcepub 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.
sourcepub 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.
sourcepub 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 Ord for Texture
impl Ord for Texture
source§impl PartialEq for Texture
impl PartialEq for Texture
source§impl PartialOrd for Texture
impl PartialOrd for Texture
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Texture
Auto Trait Implementations§
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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§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.