Skip to main content

setup_presenter

Function setup_presenter 

Source
pub fn setup_presenter(
    world: &mut World,
    render: Entity,
    renderer: Entity,
    scene_pass: Entity,
    gpu: &Gpu,
    fallback_size: (u32, u32),
    offscreen: bool,
) -> Result<(), PresenterError>
Expand description

Build the presentation path and spawn its Presenter in the host world.

render, renderer and scene_pass name the render sub-world, its renderer and the pass the scene’s own sources draw into, all already filled in. The window comes from the host world; when it has not reported a size yet, fallback_size stands in.

offscreen chooses the path. With it the scene’s frames land in a persistent target that a screenshot reads back, and a pass added after the scene’s copies that target over the swap chain; without it the scene’s pass draws straight into the swap chain – one pass and one copy fewer, which is what a plain window wants.

§Errors

Returns an error when the host has no window, the surface cannot be built, or the render sub-world, its renderer or its targets are gone.