Skip to main content

Capacities

Struct Capacities 

Source
pub struct Capacities {
    pub vertices: u32,
    pub indices: u32,
    pub meshes: u32,
    pub instances: u32,
    pub materials: u32,
    pub lights: u32,
    pub probes: u32,
}
Expand description

How much of each pool a scene reserves, in objects.

Every one of these is device-local memory taken at start-up and never grown, which is the decision crate::mesh_pool argues in full: every bind group in the renderer names those buffers, so growing one would mean rewriting every descriptor mid-life. A caller sizes them for the scene it means to build; a scene that outgrows one is refused rather than resized.

Default is what the engine’s own demo scene has always used.

Fields§

§vertices: u32

Vertices the geometry pool holds, across every resident mesh.

§indices: u32

Indices the geometry pool holds. Four per vertex is the usual ratio for indexed triangle soup, rounded up.

§meshes: u32

Entries the mesh table holds.

Distinct meshes, not instances of them: an object count sizes instances, and a mesh id names one entry here however many instances carry it. A DAG occupies one entry per level, because each level is a vertex range of its own.

§instances: u32

Instances the instance pool holds, per frame in flight.

Sized against topic 03’s exit criterion — “sandbox scene: 10k+ instanced meshes” — rather than against what is resident today.

Raising this is not linear in memory. Topic 25’s hysteresis state is one word per instance per resident group per DrawGen, and there is a generator for the camera, one per shadow cascade and one per shadow light slot.

The one capacity here that a description cannot be measured against, because objects are placed while the renderer runs rather than at build: filling it is InstancePoolError::PoolFull from ForwardRenderer::add_instance, which is where a caller finds out it is this number that wants raising.

§materials: u32

Rows the material table holds.

Distinct materials, not instances of them — a material id names one row however many instances carry it, which is the property that makes the table worth having.

§lights: u32

Rows the light list holds — the sun and every Light a caller sets.

Overflowing this is refused rather than counted, because a light missing from the list is missing from every froxel and no counter in the frame would say so.

§probes: u32

Rows the irradiance probe table holds.

One per probe of SceneDesc::probes, which is a description-measurable number like materials and is refused at build rather than at runtime.

Zero is a scene with no probes, which is what the engine’s own demo has: the table still holds one cleared row, because a buffer of no bytes is not a buffer, and reading that row adds exactly nothing. The default is deliberately not larger — a probe grid is authored, and reserving device memory for one nobody wrote is memory taken from every existing caller for a feature they have not used.

Trait Implementations§

Source§

impl Clone for Capacities

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 Capacities

Source§

impl Debug for Capacities

Source§

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

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

impl Default for Capacities

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Capacities

Source§

impl PartialEq for Capacities

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 Capacities

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> HalThreadSafe for T
where T: Send + Sync,

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

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.