pub struct TextureDescriptor {
pub width: u32,
pub height: u32,
pub depth_or_layers: u32,
pub dimension: &'static str,
pub format: GpuTextureFormat,
pub usage: u32,
pub mip_level_count: u32,
pub sample_count: u32,
pub label: Option<String>,
}Expand description
The general texture constructor, covering 2D, 2D-array, and 3D textures.
Texture2DDescriptor is the narrow preset: a single layer, a
format string, and a usage string, with no label. The two fields
TextureDescriptor adds on top of it are what keep it general —
dimension selects between a 2D texture, a 2D array, and a 3D
texture, and label names the resource in the browser’s GPU debug
tooling, which is the only way to tell two same-sized textures apart
in a capture.
Fields§
§width: u32The width in texels. Must be greater than zero.
height: u32The height in texels. Must be greater than zero.
depth_or_layers: u32The number of array layers for a 2d-array texture, or the depth
in texels for a 3d texture. 1 for a plain 2D texture.
dimension: &'static strThe texture’s dimensionality. Defaults to "2d"; a
"2d-array" or "3d" texture needs this set explicitly.
format: GpuTextureFormatThe texel format.
usage: u32The legal uses of this texture, as a usage bitmask. Combine
several TextureUsage values with |.
mip_level_count: u32The number of mip levels. Zero is treated as one.
sample_count: u32The samples per texel: 1 for an ordinary texture, 4 for a
multisampled render target.
label: Option<String>A debug label shown for this texture in the browser’s GPU
tooling, or None to leave it unnamed.