More documentation for TextureView. (#7069)

Explain how to make one and what its properties are.
This commit is contained in:
Kevin Reid
2025-02-06 13:42:10 -08:00
committed by GitHub
parent b32cbd4ea6
commit d59dce5eea
2 changed files with 10 additions and 3 deletions

View File

@@ -37,7 +37,11 @@ impl Texture {
}
}
/// Creates a view of this texture.
/// 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 create_view(&self, desc: &TextureViewDescriptor<'_>) -> TextureView {
let view = self.inner.create_view(desc);

View File

@@ -2,8 +2,11 @@ use crate::*;
/// Handle to a texture view.
///
/// A `TextureView` object describes a texture and associated metadata needed by a
/// [`RenderPipeline`] or [`BindGroup`].
/// A `TextureView` object refers to a [`Texture`], or a subset of its layers and mip levels, and
/// specifies an interpretation of the textures texels, which is needed to use a texture as a
/// binding in a [`BindGroup`] or as an attachment in a [`RenderPass`].
/// It can be created using [`Texture::create_view()`], which accepts a [`TextureViewDescriptor`]
/// specifying the properties of the view.
///
/// Corresponds to [WebGPU `GPUTextureView`](https://gpuweb.github.io/gpuweb/#gputextureview).
#[derive(Debug, Clone)]