Skip to main content

TextureViewDescriptor

Struct TextureViewDescriptor 

Source
pub struct TextureViewDescriptor { /* private fields */ }
Expand description

Descriptor for GpuTexture.createView(descriptor).

Sub-selects a single cube face / mip / array slice / depth-aspect of a texture. When you need the full texture as a 2D view (the common case), just call create_view without a descriptor; the new method accepts an Option<&TextureViewDescriptor> for callers that need the full flexibility of the WebGPU spec.

Implementations§

Source§

impl TextureViewDescriptor

Constructors and view-default resolvers for TextureViewDescriptor.

Source

pub fn full() -> Self

Returns a descriptor that selects the full texture as a 2D view. This is the cheapest view you can make; equivalent to calling texture.createView() with no argument.

Source

pub fn mip(level: u32) -> Self

Returns a descriptor that selects a single mip level of the texture. Useful when you want to read back a specific mip (e.g. the half-res blur output of a downsampling pass) without exposing the rest.

Source

pub fn depth_only() -> Self

Returns a descriptor that selects the depth-only aspect of a depth-stencil texture. Required when sampling depth in a shader (textureSample(t, s, uv) where t is a depth texture).

Source§

impl TextureViewDescriptor

Source

pub fn new( format: Option<&'static str>, dimension: Option<&'static str>, base_mip_level: u32, mip_level_count: u32, base_array_layer: u32, array_layer_count: u32, aspect: Option<&'static str>, ) -> Self

Source§

impl TextureViewDescriptor

Source

pub fn get_format(&self) -> Option<&'static str>

Source

pub fn try_get_format(&self) -> Option<&'static str>

Source

pub fn get_dimension(&self) -> Option<&'static str>

Source

pub fn try_get_dimension(&self) -> Option<&'static str>

Source

pub fn get_base_mip_level(&self) -> u32

Source

pub fn get_mip_level_count(&self) -> u32

Source

pub fn get_base_array_layer(&self) -> u32

Source

pub fn get_array_layer_count(&self) -> u32

Source

pub fn get_aspect(&self) -> Option<&'static str>

Source

pub fn try_get_aspect(&self) -> Option<&'static str>

Trait Implementations§

Source§

impl Clone for TextureViewDescriptor

Source§

fn clone(&self) -> TextureViewDescriptor

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TextureViewDescriptor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more