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.
§Arguments
u32- A 32-bit unsigned integer (u32).
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).