Skip to main content

TextureDesc

Struct TextureDesc 

Source
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: TextureSize

Width in pixels, or a fraction of the drawable.

§height: TextureSize

Height in pixels, or a fraction of the drawable.

§depth: u32

Depth 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: PixelFormat

Texel format.

§sample_count: u32

MSAA 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: u32

Number of array layers. 1 for plain 2D, 6 for cube, N for CSM shadow-map arrays.

§mip_levels: u32

Mip 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: TextureUsage

How passes bind the texture.

§clear: ClearValue

The 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

Source

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).

Source

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

Source§

fn clone(&self) -> TextureDesc

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for TextureDesc

Source§

impl Debug for TextureDesc

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for TextureDesc

Source§

fn eq(&self, other: &TextureDesc) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TextureDesc

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.