pub enum SourceFrameCache {
Gpu(FrameStore<GpuSource>),
Cpu(FrameStore<CpuSource>),
}Expand description
Prepared frames for whichever renderer runs. Decoded source frames prepared for one renderer, kept within a byte budget: what an export or a preview renders from.
Variants§
Gpu(FrameStore<GpuSource>)
Frames uploaded for the GPU renderer.
Cpu(FrameStore<CpuSource>)
Frames converted for the CPU renderer.
Implementations§
Source§impl SourceFrameCache
impl SourceFrameCache
Sourcepub fn for_renderer(renderer: ExportRenderer<'_>, bytes: u64) -> Self
pub fn for_renderer(renderer: ExportRenderer<'_>, bytes: u64) -> Self
An empty cache for renderer, keeping up to bytes of frames.
Sourcepub fn follow(&mut self, budget: &FrameBudget, held: u64)
pub fn follow(&mut self, budget: &FrameBudget, held: u64)
Sets the cache’s budget to budget less the held bytes the sources keep, evicting at once
to fit. It never goes below the last output frame’s working set, so a budget lowered under
memory pressure still lets the next frame of the same shape render.
Sourcepub fn provider(&self) -> &dyn FrameProvider
pub fn provider(&self) -> &dyn FrameProvider
The frames, for the renderer.
Sourcepub fn fill(
&mut self,
renderer: ExportRenderer<'_>,
size: RenderSize,
color: ColorPolicy,
(index, needs): (u64, &[FrameNeed]),
sources: &mut dyn SourceFrames,
cancel: &CancelToken,
) -> Result<(), ExportError>
pub fn fill( &mut self, renderer: ExportRenderer<'_>, size: RenderSize, color: ColorPolicy, (index, needs): (u64, &[FrameNeed]), sources: &mut dyn SourceFrames, cancel: &CancelToken, ) -> Result<(), ExportError>
Decodes and prepares every frame needs (of output frame index) names that the cache
does not hold, and keeps them until Self::unpin.
§Errors
A source that cannot be decoded or prepared, or one past the budget.
Sourcepub fn unpin(&mut self)
pub fn unpin(&mut self)
Lets the frames the last Self::fill kept go when the budget needs room.
Auto Trait Implementations§
impl !RefUnwindSafe for SourceFrameCache
impl !UnwindSafe for SourceFrameCache
impl Forget for SourceFrameCache
impl Freeze for SourceFrameCachewhere
*const u8 is !null: Freeze,
PhantomData<((String, i64), Entry<GpuSource>)>: Freeze,
PhantomData<((String, i64), Followed<GpuSource>)>: Freeze,
PhantomData<(String, Entry<GpuSource>)>: Freeze,
PhantomData<(u64, Entry<GpuSource>)>: Freeze,
PhantomData<((String, i64), ())>: Freeze,
PhantomData<((String, i64), Entry<CpuSource>)>: Freeze,
PhantomData<((String, i64), Followed<CpuSource>)>: Freeze,
PhantomData<(String, Entry<CpuSource>)>: Freeze,
PhantomData<(u64, Entry<CpuSource>)>: Freeze,
impl Move for SourceFrameCache
impl Send for SourceFrameCachewhere
RawTable<((String, i64), Entry<GpuSource>)>: Send,
RawTable<((String, i64), Followed<GpuSource>)>: Send,
RawTable<(String, Entry<GpuSource>)>: Send,
RawTable<(u64, Entry<GpuSource>)>: Send,
RawTable<((String, i64), ())>: Send,
RawTable<((String, i64), Entry<CpuSource>)>: Send,
RawTable<((String, i64), Followed<CpuSource>)>: Send,
RawTable<(String, Entry<CpuSource>)>: Send,
RawTable<(u64, Entry<CpuSource>)>: Send,
impl Sync for SourceFrameCachewhere
RawTable<((String, i64), Entry<GpuSource>)>: Sync,
RawTable<((String, i64), Followed<GpuSource>)>: Sync,
RawTable<(String, Entry<GpuSource>)>: Sync,
RawTable<(u64, Entry<GpuSource>)>: Sync,
RawTable<((String, i64), ())>: Sync,
RawTable<((String, i64), Entry<CpuSource>)>: Sync,
RawTable<((String, i64), Followed<CpuSource>)>: Sync,
RawTable<(String, Entry<CpuSource>)>: Sync,
RawTable<(u64, Entry<CpuSource>)>: Sync,
impl Unpin for SourceFrameCache
impl UnsafeUnpin for SourceFrameCachewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<((String, i64), Entry<GpuSource>)>: UnsafeUnpin,
PhantomData<((String, i64), Followed<GpuSource>)>: UnsafeUnpin,
PhantomData<(String, Entry<GpuSource>)>: UnsafeUnpin,
PhantomData<(u64, Entry<GpuSource>)>: UnsafeUnpin,
PhantomData<((String, i64), ())>: UnsafeUnpin,
PhantomData<((String, i64), Entry<CpuSource>)>: UnsafeUnpin,
PhantomData<((String, i64), Followed<CpuSource>)>: UnsafeUnpin,
PhantomData<(String, Entry<CpuSource>)>: UnsafeUnpin,
PhantomData<(u64, Entry<CpuSource>)>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more