pub struct TextureDesc {
pub width: TextureSize,
pub height: TextureSize,
pub depth: u32,
pub format: PixelFormat,
pub sample_count: u32,
pub array_layers: u32,
pub mip_levels: u32,
pub usage: TextureUsage,
pub clear: ClearValue,
}Expand description
Texture-shape description carried by both imported and transient resources. This is the authoritative shape: the aliaser sizes a resource from it and each backend’s transient pool translates it into a native descriptor, so a desc that disagrees with what the backend would have created is a defect rather than a documentation slip.
Fields§
§width: TextureSizeWidth in pixels, or a fraction of the drawable.
height: TextureSizeHeight in pixels, or a fraction of the drawable.
depth: u32Depth extent of a 3D texture, 1 for 2D and 2D-array textures. Distinct
from array_layers: 3D slices mip down with the other two axes, array
layers do not.
format: PixelFormatTexel format.
sample_count: u32MSAA sample count, 1 for non-multisample. The graph doesn’t care what value this is; the backend executor maps it to its API’s sample-count enum.
array_layers: u32Number of array layers. 1 for plain 2D, 6 for cube, N for CSM shadow-map arrays.
mip_levels: u32Mip levels in the chain, 1 for a single-level target. A resource whose consumers sample coarser levels (the Hi-Z pyramid, a bloom octave chain) carries its real count, since the levels past 0 are a third of the footprint the aliaser packs.
usage: TextureUsageHow passes bind the texture.
clear: ClearValueThe value this target is cleared to at the head of the pass that writes it. Part of the shape rather than the encoder’s business because D3D12 bakes an optimized clear value into the resource at creation: a placed resource created with one value and cleared to another is both a debug-layer warning and a real decompression cost, and the pool creates the resource while the feature owns the clear. A target whose background means something (roughness clears to 1.0 = fully rough, so untouched pixels reflect nothing) reads wrong on its first frame if these disagree.
Implementations§
Source§impl TextureDesc
impl TextureDesc
Sourcepub fn extent(&self, drawable_w: u32, drawable_h: u32) -> (u32, u32, u32)
pub fn extent(&self, drawable_w: u32, drawable_h: u32) -> (u32, u32, u32)
Resolved pixel extent at the given drawable extent, as the backend must
create it: (width, height, depth).
Sourcepub fn byte_size(&self, drawable_w: u32, drawable_h: u32) -> u64
pub fn byte_size(&self, drawable_w: u32, drawable_h: u32) -> u64
The resource’s memory footprint in bytes at the given drawable extent: the summed texel count of every mip level, times bytes-per-texel, sample count and array layers. The aliasing planner sums and packs these. Sample count multiplies the whole chain, which is exact for the only shape that carries both (a multisample target is single-mip).
Trait Implementations§
Source§impl Clone for TextureDesc
impl Clone for TextureDesc
Source§fn clone(&self) -> TextureDesc
fn clone(&self) -> TextureDesc
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more