Skip to main content

Module present

Module present 

Source
Expand description

The multi-world presentation path.

The machinery a windowed scene presents with – the Presenter component, the window surface, the offscreen target and the behaviours that pump, resize and present – lives in unlit3d::winit::presenter; this module re-exports it and adds the multi-world pacing. The host world owns the window and the presenter; the renderer and the passes live in a render sub-world. Frames are queued as a command rather than drawn inline, so the host’s own async tasks are polled between the event callbacks, and the draw behaviour drains the sub-world’s command queue before dispatching the frame into it – which is what makes the sub-world a server: clients’ requests land as jobs here, on the main thread, between one frame’s render and the next.

Re-exports§

use unlit_ecs::Entity; 🔒
use unlit_ecs::World; 🔒
use unlit3d::frame::FrameBehaviourOrder; 🔒
use unlit3d::frame::OnFrame; 🔒
use unlit3d::frame::dispatch_frame; 🔒
use unlit3d::offscreen::OFFSCREEN_SAMPLES; 🔒
use unlit3d::offscreen::TargetConfig; 🔒
use unlit3d::winit::builtin::Resumed; 🔒
use unlit3d::winit::builtin::window; 🔒
use unlit3d::winit::event::OnAboutToWait; 🔒
use unlit3d::winit::event::OnWindowEvent; 🔒
use unlit3d::winit::presenter::PRESENT_ORDER; 🔒
use unlit3d::winit::presenter::PresentationPath; 🔒
use unlit3d::winit::presenter::pump_presented_with; 🔒
use crate::executor::LocalTasks; 🔒
use crate::gpu::Gpu; 🔒
use crate::host::drain_sub_world; 🔒

Structs§

Presenter
Everything needed to render a frame and present it.

Enums§

PresenterError
Why the presentation path could not be built, or a frame could not be presented.

Constants§

BLIT_PASS_ORDER
The order the offscreen path’s copying pass records at: after the scene’s own, so the target it samples holds this frame’s picture.
SCENE_PASS_ORDER
The order a scene’s own pass records at, ahead of the copying pass.

Functions§

draw_presented
The draw behaviour: drain the render sub-world’s command queue, then dispatch the frame into it and present the result.
pump_presented
The behaviours that keep frames coming: one per turn of the event loop, plus one per compositor redraw request.
resize_presented
The resize behaviour: match the presenter to the window’s new size, skipping the degenerate zero size windows report on minimize.
setup_presenter
Build the presentation path and spawn its Presenter in the host world.