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.
impl TextureViewDescriptor
Constructors and view-default resolvers for TextureViewDescriptor.
Sourcepub fn full() -> Self
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.
Sourcepub fn mip(level: u32) -> Self
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.
Sourcepub fn depth_only() -> Self
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
impl TextureViewDescriptor
pub fn get_format(&self) -> Option<&'static str>
pub fn try_get_format(&self) -> Option<&'static str>
pub fn get_dimension(&self) -> Option<&'static str>
pub fn try_get_dimension(&self) -> Option<&'static str>
pub fn get_base_mip_level(&self) -> u32
pub fn get_mip_level_count(&self) -> u32
pub fn get_base_array_layer(&self) -> u32
pub fn get_array_layer_count(&self) -> u32
pub fn get_aspect(&self) -> Option<&'static str>
pub fn try_get_aspect(&self) -> Option<&'static str>
Trait Implementations§
Source§impl Clone for TextureViewDescriptor
impl Clone for TextureViewDescriptor
Source§fn clone(&self) -> TextureViewDescriptor
fn clone(&self) -> TextureViewDescriptor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more