Skip to main content

FullscreenPass

Trait FullscreenPass 

Source
pub trait FullscreenPass {
    type Rec;

    // Required methods
    fn begin(&self, rec: &Self::Rec);
    fn draw(&self, rec: &Self::Rec);
    fn end(&self, rec: &Self::Rec);
}
Expand description

A single-draw fullscreen post pass (SSR resolve, TAA resolve, …): target a render target, bind a pipeline + inputs, draw one fullscreen triangle, restore. Unlike the bloom + composite chains (whose drivers hold a mip / text loop), a fullscreen pass has no loop, so the driver is a fixed begin -> draw -> end. The value is the shared per-backend lifecycle factored behind begin/end (DX: the PSR<->RENDER_TARGET barrier bracket + render-target bind; VK: the render-pass bracket), reused across every such pass instead of re-pasted per pass.

The inert-pass guard lives at each backend’s call site: it resolves the pass’s resources (returning early if a required one is absent) BEFORE constructing the encoder, so the driver always runs all three steps over a fully-resolved pass and can never leave a render pass / barrier half-open. There is no Args: each backend’s encoder is a small struct holding the already-resolved references + per-call scalars, so the trait names no backend types (like BloomEncoder).

Implemented by DirectX + Vulkan. Metal keeps its own fullscreen_pass helper, which already factors this begin/draw/end skeleton, so this seam is unused (dead code) on a Metal build.

Required Associated Types§

Source

type Rec

Per-backend command recorder (DX ID3D12GraphicsCommandList, VK vk::CommandBuffer).

Required Methods§

Source

fn begin(&self, rec: &Self::Rec)

Begin: bind the target render target + set the full-resolution viewport / scissor. DX transitions the target PIXEL_SHADER_RESOURCE -> RENDER_TARGET, binds its RTV + the SRV heap; VK begins the pass’s render pass.

Source

fn draw(&self, rec: &Self::Rec)

Bind the pipeline + inputs + per-frame params and draw the fullscreen triangle (3 vertices; the vertex shader builds the triangle from the id).

Source

fn end(&self, rec: &Self::Rec)

End: DX transitions the target back to PIXEL_SHADER_RESOURCE; VK ends the render pass.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§