pub struct PreRender {
ranges: Vec<(f64, f64)>,
queue: Vec<i64>,
done: Vec<(i64, u64)>,
dirty: Vec<i64>,
inflight: Vec<(i64, u64)>,
generation: Arc<AtomicU64>,
worker: Option<Worker>,
}Fields§
§ranges: Vec<(f64, f64)>Requested ranges, seconds, merged and clamped to whole seconds.
queue: Vec<i64>Whole seconds still to render, in order. A second stays here while a worker has it.
done: Vec<(i64, u64)>Seconds rendered this session with the key they were rendered under.
dirty: Vec<i64>Seconds invalidated since they were rendered (never served, always re-rendered).
inflight: Vec<(i64, u64)>Seconds handed to the worker, with the key each is rendering under.
generation: Arc<AtomicU64>Bumped by every invalidation; a job behind it is dropped mid-second.
worker: Option<Worker>Spawned on the first queued second, dropped when the queue drains.
Implementations§
Source§impl PreRender
impl PreRender
pub fn new() -> Self
Sourcepub fn invalidate(&mut self, from: f64, to: f64)
pub fn invalidate(&mut self, from: f64, to: f64)
Mark a range dirty (an edit touched it).
Sourcepub fn tick(
&mut self,
project: &Project,
_budget_ms: f32,
gpu: Option<Sender<GpuFrameRequest>>,
) -> bool
pub fn tick( &mut self, project: &Project, _budget_ms: f32, gpu: Option<Sender<GpuFrameRequest>>, ) -> bool
Collect finished seconds and keep the worker fed (call once per frame). Returns true while work
is outstanding. The budget is ignored: rendering left the UI thread, so there is nothing to slice.
gpu: the GPU renderer’s request channel when it is on, so new jobs composite through it (falling
back to the CPU compositor per-second if it stops answering); pass None to force CPU rendering.
Sourcepub fn frame(&self, project: &Project, t: f64) -> Option<Arc<Frame>>
pub fn frame(&self, project: &Project, t: f64) -> Option<Arc<Frame>>
A pre-rendered frame for time t, when the cache holds a valid one.
Sourcepub fn segments(&self) -> Vec<(f64, f64, bool)>
pub fn segments(&self) -> Vec<(f64, f64, bool)>
Requested ranges as merged runs of whole seconds with their state: (from, to, ready).
Drawn as the pre-render bar at the top of the timeline.
pub fn clear(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PreRender
impl RefUnwindSafe for PreRender
impl Send for PreRender
impl !Sync for PreRender
impl Unpin for PreRender
impl UnwindSafe for PreRender
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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