Skip to main content

execute_layers

Function execute_layers 

Source
pub fn execute_layers<H>(
    ctx: &mut <H as Hal>::Context,
    recording: &Recording,
    images: &[&<H as Hal>::Texture],
    format: PixelFormat,
) -> Result<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 every pass except the root, returning the layer targets in order.

Split out from execute so that a caller who has to submit the root pass itself can still get the layers rendered. That is not a hypothetical: the root is the pass that lands in a presentable image, and presenting one means submitting it gated on the acquire and present semaphores — which is a different call from the one that renders offscreen and waits. Without this split, a frame with layers could be rendered offscreen and never presented.

The returned textures are the caller’s to destroy, and must outlive the submission that samples them.