Skip to main content

RetainedPages

Struct RetainedPages 

Source
pub struct RetainedPages<T = Texture, V = TextureView> { /* private fields */ }
Expand description

The renderer’s retained pages: a budgeted, least-recently-used store keyed by the raw retained key (see the module doc).

Implementations§

Source§

impl<T, V> RetainedPages<T, V>

Source

pub fn new(budget: RetainedBudget, max_dimension: u32) -> Self

An empty store held to budget, with pages capped at max_dimension per axis (and never above MAX_INTERMEDIATE_DIMENSION).

Source

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

An empty store budgeted and capped for caps’ adapter.

Source

pub fn budget(&self) -> RetainedBudget

The budget the store is held to.

Source

pub fn set_budget(&mut self, budget: RetainedBudget)

Re-budget the store, evicting least recently used pages until what it holds fits.

Source

pub fn max_dimension(&self) -> u32

The largest page extent the store allocates, per axis.

Source

pub fn len(&self) -> usize

How many pages are resident.

Source

pub fn is_empty(&self) -> bool

Whether no page is resident.

Source

pub fn used_bytes(&self) -> u64

The bytes of texture the resident pages hold.

Source

pub fn contains(&self, key: u64) -> bool

Whether key has a resident page.

Source

pub fn frame(&self) -> u64

The store’s frame clock: how many frames have been planned.

Source

pub fn generation(&self) -> u64

A counter advanced whenever the set Self::entries reports changes — a page added, evicted, re-rendered at another extent or scale, or the store cleared. A caller publishing the ledger only when this moved publishes every change and nothing else.

Source

pub fn entries(&self) -> impl Iterator<Item = RetainedEntry> + '_

The resident pages, as the ledger reports them, in no particular order.

Source

pub fn take_refusal(&mut self) -> bool

Whether a DrawRetained refusal cleared the store since the last call, clearing the flag — what lets a host ask for one more frame to be painted against the emptied ledger.

Source

pub fn clear(&mut self)

Drop every page.

What a surface recreate, a resize and a DrawRetained refusal all do: the ledger the widget tree paints against goes empty with it, and every body is painted (and, where admitted, recorded) again.

Source

pub fn page_for(&self, bracket: u32) -> Option<(&V, (u32, u32))>

The view and texture extent of the page retained bracket bracket of the last committed frame renders into or composites from.

Source

pub fn plan( &mut self, brackets: &[RetainedBracket], layers: &mut [RecordedLayer], ) -> Result<RetainedPlan, EngineError>

Decide one frame: which bodies render into a retained page, which DrawRetaineds composite from one and where, and which pages make room (see the module doc). Advances the frame clock; changes nothing else unless it refuses.

layers is the frame’s recorded layers, for each body’s drawn bounds; every layer enclosing a served draw has its bounds grown to hold the draw’s composite (rounded out to tiles) before any body is sized.

§Errors

EngineError::RetainedKeyMissing for the first DrawRetained whose key is not resident at its placement — and the store is cleared.

Source

pub fn commit<A>( &mut self, allocator: &A, brackets: &[RetainedBracket], superseded: &[u64], plan: &RetainedPlan, rendered: &[bool], )
where A: TextureAllocator<Texture = T, View = V>,

Apply plan, decided for brackets, once nothing about the frame can fail any more: evict, then give every admitted body the schedule really rendered (rendered, indexed like brackets) its page, then bind each bracket to the page it uses this frame.

The evictions are the plan’s least-recently-used ones plus every key the frame re-recorded without its page receiving that recording (see the module doc’s A page holds this frame’s recording, or goes): a body the plan refused, an admitted body the schedule did not render, and every key in superseded — the PushRetained brackets the compiler swallowed into an enclosing one (CompiledFrame::retained_superseded).

Trait Implementations§

Source§

impl<T: Debug, V: Debug> Debug for RetainedPages<T, V>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T, V> Freeze for RetainedPages<T, V>
where Vec<RetainedPage<T, V>>: Freeze,

§

impl<T, V> RefUnwindSafe for RetainedPages<T, V>
where Vec<RetainedPage<T, V>>: RefUnwindSafe,

§

impl<T, V> Send for RetainedPages<T, V>
where Vec<RetainedPage<T, V>>: Send,

§

impl<T, V> Sync for RetainedPages<T, V>
where Vec<RetainedPage<T, V>>: Sync,

§

impl<T, V> Unpin for RetainedPages<T, V>
where Vec<RetainedPage<T, V>>: Unpin,

§

impl<T, V> UnsafeUnpin for RetainedPages<T, V>
where Vec<RetainedPage<T, V>>: UnsafeUnpin,

§

impl<T, V> UnwindSafe for RetainedPages<T, V>
where Vec<RetainedPage<T, V>>: UnwindSafe,

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