Skip to main content

SceneLimits

Struct SceneLimits 

Source
pub struct SceneLimits {
    pub max_entities: u32,
    pub max_snapshot_instances: u32,
    pub max_snapshots: u32,
    pub managed_cpu_bytes: u64,
}
Expand description

CPU ownership budgets. The byte ceiling accounts columns, slots, free indices, snapshots and step scratch, excluding allocator overhead and independently owned mesh/material assets.

Fields§

§max_entities: u32

Maximum live/retired identity slots and capacity of each maintained archetype.

§max_snapshot_instances: u32

Maximum instances copied into one frame snapshot.

§max_snapshots: u32

Maximum simultaneously owned snapshots, in 1..8.

§managed_cpu_bytes: u64

Accounted CPU reservation ceiling, at most 512 MiB.

Implementations§

Source§

impl SceneLimits

Source

pub fn reservation_bytes(self) -> Result<u64, RenderError>

Validate capacity and compute the conservative reservation before allocating columns.

Examples found in repository?
examples/scene_admission.rs (line 23)
16fn sample(count: u32, binding: RenderBinding) -> Result<(u128, u128, u64)> {
17    let limits = SceneLimits {
18        max_entities: count,
19        max_snapshot_instances: count,
20        max_snapshots: 1,
21        managed_cpu_bytes: 512 * 1024 * 1024,
22    };
23    let bytes = limits.reservation_bytes()?;
24    let mut world = SceneWorld::new(limits)?;
25    let mut entities = Vec::with_capacity(count as usize);
26    let started = Instant::now();
27    for _ in 0..count {
28        entities.push(world.spawn(black_box(Transform::default()), black_box(binding), None)?);
29    }
30    let initial = started.elapsed().as_nanos();
31    let started = Instant::now();
32    for id in entities.drain(..) {
33        world.despawn(black_box(id))?;
34    }
35    for _ in 0..count {
36        entities.push(world.spawn(black_box(Transform::default()), black_box(binding), None)?);
37    }
38    let reuse = started.elapsed().as_nanos();
39    black_box((&world, &entities));
40    assert_eq!(world.len(), count as usize);
41    Ok((initial, reuse, bytes))
42}

Trait Implementations§

Source§

impl Clone for SceneLimits

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 SceneLimits

Source§

impl Debug for SceneLimits

Source§

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

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

impl Default for SceneLimits

Source§

fn default() -> Self

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

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

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.