Skip to main content

IRenderLoop

Trait IRenderLoop 

Source
pub trait IRenderLoop: Send + Sync {
    // Required methods
    fn add(&self, i: Arc<dyn IRenderLoopTask>);
    fn remove(&self, i: &Arc<dyn IRenderLoopTask>);
    fn runs_in_background(&self) -> bool;
    fn wakeup(&self);

    // Provided method
    fn request_frame_out_of_turn(&self) { ... }
}
Expand description

The application render loop.

The render loop is responsible for advancing the animation timer and updating the scene graph for visible windows.

Required Methods§

Source

fn add(&self, i: Arc<dyn IRenderLoopTask>)

Adds an update task.

Registered update tasks will be polled on each tick of the render loop after the animation timer has been pulsed.

Source

fn remove(&self, i: &Arc<dyn IRenderLoopTask>)

Removes an update task.

Source

fn runs_in_background(&self) -> bool

Indicates if the rendering is done on a non-UI thread.

Source

fn wakeup(&self)

Wakes up the render loop to schedule the next tick. Thread-safe: can be called from any thread.

Provided Methods§

Source

fn request_frame_out_of_turn(&self)

Asks for a frame out of turn: a tick as soon as the thread that ticks can produce one. Not from upstream.

Called by the thread of a compositor before it blocks until a batch has been processed or rendered by the render thread, after the batch was committed (which wakes the loop up). The frame is never rendered on the calling thread. The default does nothing: the caller then waits for the next tick of the loop.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§