Skip to main content

AtlasBudget

Struct AtlasBudget 

Source
pub struct AtlasBudget {
    pub atlas_size: (u32, u32),
    pub max_atlases: usize,
}
Expand description

The atlas geometry a tier of adapter is given.

Never vello_common’s own AtlasConfig default: that is 4096 square across eight layers, 64 MiB of Rgba8Unorm per layer and half a gigabyte in total, which is a desktop-only figure that a phone would pay for the first image it drew.

Fields§

§atlas_size: (u32, u32)

Extent of each atlas layer, in pixels.

§max_atlases: usize

Maximum number of layers the array may grow to.

Implementations§

Source§

impl AtlasBudget

Source

pub const MOBILE: Self

The budget a tile-based or downlevel-clamped adapter gets: 4 MiB a layer, 16 MiB in total.

Source

pub const DESKTOP: Self

The budget a full-profile immediate-mode adapter gets: 16 MiB a layer, 128 MiB in total.

Source

pub fn for_caps(caps: &TierCaps) -> Self

The budget for caps’ adapter, clamped to what it can actually create.

The tier choice is is_mobile_tier; the clamps that follow are the adapter’s own texture-edge and array-layer ceilings plus the eight-bit MAX_ATLAS_LAYERS the encoded-image record can address.

FRUST_ENGINE_ATLAS_SIZE overrides the tier’s extent, and the override is budgeted, not unbudgeted: it passes through within_total_bytes against the tier’s own total_bytes before the adapter clamps. So the knob redistributes a tier’s memory between extent and depth — one large layer instead of eight small ones — and cannot spend more of it than the tier itself would. Clamped to the adapter last, because an override is a request and a request the adapter cannot honour is still narrowed to what it can.

The resolved budget is reported once per process through atlas_tier_line, because which of the two tiers a given phone takes is otherwise an inference from behaviour rather than an observation: the signals is_mobile_tier reads are the driver’s own answers, and a device whose driver answers differently from the one it resembles is exactly the case a benchmark capture has to be able to name. That line is perf-trace-only, like every other frust-perf line the engine emits — a build without the feature resolves the same budget and writes nothing.

Source

pub fn within_total_bytes(self, total_bytes: u64) -> Self

This budget narrowed so a fully grown array costs at most total_bytes.

The extent goes first, scaled uniformly until one layer fits inside the whole allowance; the layer count then takes whatever multiple of that layer is left, never below one. Scaling the extent rather than only the depth is what makes the ceiling hold at all: a single 16384-square layer is a gigabyte on its own, so a clamp that could only reduce the layer count would have nothing left to reduce.

Both axes are floored after the uniform scale, which can only take the product below the allowance — except where an extreme aspect ratio floors one axis to nothing and it is raised back to a texel, so each axis is then held against what the other leaves.

Source

pub fn contains(self, region: AtlasRegion, layers: u32) -> bool

Whether region lies inside an atlas array of layers layers at this budget’s per-layer extent.

The pure counterpart of crate::gpu::atlas::AtlasArray::contains, answerable with no device: a consumer that records where an image lives before the array exists checks the rectangle here, so it can never come to name a region the array will refuse to write and then sample it as whatever the texture happened to hold.

Source

pub fn clamped(self, caps: &TierCaps) -> Self

This budget narrowed to what caps’ adapter can create.

Source

pub fn config(self) -> AtlasConfig

The vello_common configuration this budget describes.

initial_atlas_count is zero so the first layer is created by the first allocation that needs one: an application drawing no images pays for no atlas at all, and vello_common::multi_atlas::MultiAtlasManager::new’s own expect on eager creation can never be reached.

Source

pub fn layer_bytes(self) -> u64

The bytes one fully populated layer costs at ATLAS_FORMAT_BYTES.

Source

pub fn total_bytes(self) -> u64

The bytes every layer of this budget costs once fully grown.

Trait Implementations§

Source§

impl Clone for AtlasBudget

Source§

fn clone(&self) -> Self

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 AtlasBudget

Source§

impl Debug for AtlasBudget

Source§

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

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

impl Eq for AtlasBudget

Source§

impl PartialEq for AtlasBudget

Source§

fn eq(&self, other: &Self) -> 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 AtlasBudget

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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, !>

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.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,