pub struct Texture2DDescriptor {
pub width: u32,
pub height: u32,
pub format: GpuTextureFormat,
pub mip_level_count: u32,
pub sample_count: u32,
}Expand description
A 2D texture descriptor for create_texture_2d.
Defaults produce a 1x1 RGBA8 texture with TEXTURE_BINDING | COPY_DST | COPY_SRC usage, which is the right baseline for a sampled color
texture that is uploaded to via queue.writeTexture. Override fields
after constructing to set mip_level_count, sample_count, or
different usage flags.
Fields§
§width: u32The texture width in pixels. Must be > 0.
height: u32The texture height in pixels. Must be > 0.
format: GpuTextureFormatThe texel format, as one of the GpuTextureFormat variants.
mip_level_count: u32The number of mip levels. 0 is treated as 1.
sample_count: u32The number of samples per texel (1 for non-MSAA, 4 for MSAA).
Implementations§
Source§impl Texture2DDescriptor
Default-construction helper for Texture2DDescriptor.
impl Texture2DDescriptor
Default-construction helper for Texture2DDescriptor.
Sourcepub fn default_for(width: u32, height: u32, format: GpuTextureFormat) -> Self
pub fn default_for(width: u32, height: u32, format: GpuTextureFormat) -> Self
Returns a descriptor with the most common defaults applied.
This is the same as calling the generated new constructor and
then explicitly setting the defaults; we provide it so callers
can do Texture2DDescriptor::default_for(w, h, format) instead of
having to remember which fields to set.
§Arguments
u32- The texture width in pixels.u32- The texture height in pixels.GpuTextureFormat- The texel format.
§Returns
Self- A new descriptor withmip_level_count = 1andsample_count = 1.