Skip to main content

execute_deferred

Function execute_deferred 

Source
pub fn execute_deferred<H>(
    ctx: &mut <H as Hal>::Context,
    surface: &mut <H as Hal>::Texture,
    recording: &Recording,
    images: &[&<H as Hal>::Texture],
) -> Result<(<H as Hal>::Fence, Transient<H>), Error>
where H: Hal, <H as Hal>::Context: HalContext<Hal = H>,
Expand description

Draw a recording into a texture this crate did not create.

Context::draw covers the case where the target came from Context::create_surface, and that is the ordinary one. This is the other: a swapchain hands out its own images, and drawing into one means naming a texture the caller got from somewhere else. Without this the presentation path re-exported above reached a swapchain and then had nothing to draw into its images with, which is a window a caller can open and not fill. Render a recording’s layers, then submit its root without waiting.

The shape a display path needs. Everything but the root is a prerequisite of it rather than part of the frame’s pacing, so those go through the waiting submission and are ordered before the root by having finished; only the root produces a fence, because the fence is what a page flip is gated on and the root is the pass that fills the image being flipped.

Both halves of the return travel together until the fence retires: the layer targets are what the submission is still sampling. Handing them back rather than hiding them is deliberate — a caller that owns the fence is the only one that knows when it retires.