pub struct RenderSession { /* private fields */ }Implementations§
Source§impl RenderSession
impl RenderSession
pub fn new(config: RenderConfig) -> Self
Sourcepub fn add_plan(&mut self, index: u32, plan: &FramePlan)
pub fn add_plan(&mut self, index: u32, plan: &FramePlan)
Hands over a stored plan before the first frame is rendered: the session reads every plan’s moving-region placements to find where each canvas’s page ends (elastic overscroll, docs/ARCHITECTURE.md §十). A host that hands over none renders as if no page had edges.
Sourcepub fn configure_tiles(
&self,
cache: &mut TileCache,
memory_mb: f64,
) -> Option<Diagnostic>
pub fn configure_tiles( &self, cache: &mut TileCache, memory_mb: f64, ) -> Option<Diagnostic>
Sizes the tile cache for this pass: the memory setting less what the pass itself holds (the ring’s frames
and the frame-sized planes around them, each fixed region’s saved copy and history, 8 MB of headroom), then
raised to what one frame paints. Returns the MEMORY_BUDGET_RAISED diagnostic (info) when it had to raise the limit:
from, to and mb for the message, and a { budgetMB, tiles, raisedBy } detail.
pub fn counters(&self) -> RenderCounters
Sourcepub fn meta(&self, canvas: &str) -> Option<CanvasMeta>
pub fn meta(&self, canvas: &str) -> Option<CanvasMeta>
The canvas’s metadata as the pass holds it now, if it has been loaded.
Sourcepub fn take_events(&mut self) -> Vec<Diagnostic>
pub fn take_events(&mut self) -> Vec<Diagnostic>
Diagnostics raised since the last call, in emission order: NONFINITE_POSE (error; a placement’s resolved
pose cannot be placed, it is recorded as skipped at (0, 0)), and the compositor’s INCOMPLETE_TEMPORAL_PATCH
and TEMPORAL_OR_ALIGNMENT_CONFLICT (warnings; conflicts the pixels detected before patching, every
conflicting rect in detail.regions).
Sourcepub fn take_dirty_metas(&mut self) -> Vec<(String, CanvasMeta)>
pub fn take_dirty_metas(&mut self) -> Vec<(String, CanvasMeta)>
Canvases whose metadata changed since the last call, in the order they first changed, with their current values.
Sourcepub fn wanted_votes(
&self,
index: u32,
has_prev: bool,
has_next: bool,
) -> Vec<i64>
pub fn wanted_votes( &self, index: u32, has_prev: bool, has_next: bool, ) -> Vec<i64>
The consistency/<frame> records the host should read for frame index (in this order) before
RenderSession::begin: the frame’s own, then its previous and next frame’s when those are in hand,
leaving out what the window still holds.
Sourcepub fn begin(
&mut self,
input: FrameInput,
votes: Vec<(i64, Option<ConsistencyRecord>)>,
) -> Result<(), RenderError>
pub fn begin( &mut self, input: FrameInput, votes: Vec<(i64, Option<ConsistencyRecord>)>, ) -> Result<(), RenderError>
Starts compositing one frame. votes are the records RenderSession::wanted_votes named, None where
no row is stored.
Sourcepub fn cancel(&mut self, compositor: &mut Compositor)
pub fn cancel(&mut self, compositor: &mut Compositor)
Abandons the frame in progress (the host failed or stopped between steps), and the compositor’s placement with it. What the frame already changed (metadata, saved fixed-region pixels, last placements) stays, as it did when the pass failed mid-frame before.
Sourcepub fn provide_meta(&mut self, canvas: &str, meta: Option<CanvasMeta>)
pub fn provide_meta(&mut self, canvas: &str, meta: Option<CanvasMeta>)
Hands over the metadata of the canvas RenderStep::NeedMeta asked for; None when no row is stored (the
next step then fails).
Sourcepub fn frame_slot(&mut self, index: u32) -> &mut [u8] ⓘ
pub fn frame_slot(&mut self, index: u32) -> &mut [u8] ⓘ
The ring slot frame index goes into, for the host to write its RGBA after RenderStep::NeedFrame. The
slot filled longest ago is reused, but never one holding the frame in progress or either of its neighbours.
Sourcepub fn step(&mut self, io: &mut RenderIo<'_>) -> Result<RenderStep, RenderError>
pub fn step(&mut self, io: &mut RenderIo<'_>) -> Result<RenderStep, RenderError>
Runs the frame until it needs something from the host or is done. On an error the frame is abandoned (and the compositor’s placement cancelled); the session stays usable.
Sourcepub fn begin_finish(&mut self) -> Result<bool, RenderError>
pub fn begin_finish(&mut self) -> Result<bool, RenderError>
Ends the run’s fixed regions after the last frame: each one’s first epoch closes and its first frame without
transients is worked out, and a region whose state kept changing (more than [DYNAMIC_SHARE] of its frames,
and more than [DYNAMIC_FRAMES], settled into a new state) gets its first frame back on its canvas, as it
was, instead of its last state. Returns whether there is anything to paint;
when there is, step the session as for a frame until RenderStep::Done (its observation is empty and is
not a ledger row). Call once, after the last frame.
Sourcepub fn patch_reference(
&self,
rgba: &mut [u8],
width: usize,
height: usize,
frame: u32,
) -> bool
pub fn patch_reference( &self, rgba: &mut [u8], width: usize, height: usize, frame: u32, ) -> bool
Paints every fixed region’s first frame without transients into rgba (width × height, the reference frame
frame), after RenderSession::begin_finish; returns whether any pixel changed. Regions whose first
observation was another frame are left alone.
Auto Trait Implementations§
impl Freeze for RenderSession
impl RefUnwindSafe for RenderSession
impl Send for RenderSession
impl Sync for RenderSession
impl Unpin for RenderSession
impl UnsafeUnpin for RenderSession
impl UnwindSafe for RenderSession
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
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