Struct PreRender

Source
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

Source

pub fn new() -> Self

Source

pub fn invalidate(&mut self, from: f64, to: f64)

Mark a range dirty (an edit touched it).

Source

pub fn request(&mut self, project: &Project, a: f64, b: f64)

Queue [a, b) for rendering.

Source

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.

Source

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.

Source

pub fn progress(&self) -> f32

Fraction of the requested range that is ready.

Source

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.

Source

pub fn clear(&mut self)

Trait Implementations§

Source§

impl Default for PreRender

Source§

fn default() -> PreRender

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

§

impl<T> MaybeSend for T

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,