Skip to main content

IntermediateTargets

Struct IntermediateTargets 

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

The engine’s pool of off-screen intermediates, with its own frame clock.

The clock is what the substrate pool ages entries against; it advances once per Self::end_frame, including frames that acquired nothing — those are the frames a parked entry ages on.

Implementations§

Source§

impl<T, V> IntermediateTargets<T, V>

Source

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

A pool sized for caps’ adapter.

Source

pub fn max_texture_size(&self) -> u32

The largest intermediate this pool will allocate, per axis.

Source

pub fn frame(&self) -> u64

The frame clock parked entries age against.

Source

pub fn stats(&self) -> PoolStats

The underlying pool’s counters.

Source

pub fn descriptor(width: u32, height: u32, label: &str) -> TextureDesc

The descriptor an intermediate of width x height is requested with, before the pool quantizes it.

Source

pub fn acquire<A>( &mut self, allocator: &A, width: u32, height: u32, label: &str, ) -> IntermediateTexture<T, V>
where A: TextureAllocator<Texture = T, View = V>,

Hands out an intermediate of at least width x height, or refuses it for exceeding Self::max_texture_size.

The check is on the requested extent rather than the quantized one: the substrate pool clamps its quantization to the adapter ceiling already, so a request inside the engine’s ceiling can never quantize past the adapter’s.

Source

pub fn release(&mut self, texture: PooledTexture<T, V>)

Parks an intermediate for reuse.

Source

pub fn end_frame(&mut self)

Advances the frame clock and ages parked entries out of the pool.

Call once per frame, whether or not the frame acquired anything.

Source

pub fn drop_parked(&mut self)

Drops the parked entries the last RESIZE_KEEP_ALIVE_FRAMES frames did not use, keeping the pool itself and its counters.

This is what a surface resize calls. A page keyed on the old surface extent is dead weight the moment the surface changes size, and holding it for the pool’s full keep-alive window is waste — so a resize collapses that window to the frames immediately behind it instead of waiting a second for the ordinary aging to reach them.

It collapses the window rather than emptying the pool, and the difference is the whole point. Not every page is keyed on the surface: a fading card, a dismissing sheet, a menu at its own size all ask for the same page extent whatever the window does, and a window edge being dragged produces a resize per frame. Dropping everything on each of them would evict that page between every pair of frames that wants it and turn the pool back into a plain allocator for the whole drag — exactly the failure the substrate pool’s aging slack exists to prevent (see frust_gpu::pool’s module header). Keeping what the frames right behind this resize actually used is bounded by what one frame can hold live at once and is precisely the set the next frame asks for again.

Implemented by aging against a clock far enough ahead to expire everything older, without moving this pool’s own clock: the frame counter still advances once per Self::end_frame, so a resize does not age unrelated entries by a second every time a window edge moves. Entries still checked out are untouched — the pool does not hold those.

Trait Implementations§

Source§

impl<T: Debug, V: Debug> Debug for IntermediateTargets<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 IntermediateTargets<T, V>
where TexturePool<T, V>: Freeze,

§

impl<T, V> RefUnwindSafe for IntermediateTargets<T, V>

§

impl<T, V> Send for IntermediateTargets<T, V>
where TexturePool<T, V>: Send,

§

impl<T, V> Sync for IntermediateTargets<T, V>
where TexturePool<T, V>: Sync,

§

impl<T, V> Unpin for IntermediateTargets<T, V>
where TexturePool<T, V>: Unpin,

§

impl<T, V> UnsafeUnpin for IntermediateTargets<T, V>
where TexturePool<T, V>: UnsafeUnpin,

§

impl<T, V> UnwindSafe for IntermediateTargets<T, V>
where TexturePool<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,