pub struct AuxTarget { /* private fields */ }Expand description
A second swapchain plus its own text layer.
Its own layer, not the renderer’s: glyphon’s atlas and viewport are built against one surface format and one resolution, and the console’s differ from the output’s. Sharing one would make the console’s size the output’s, which is the bug ADR-0037 describes in its other clothes.
Implementations§
Source§impl AuxTarget
impl AuxTarget
Sourcepub fn new(
ctx: &RenderContext,
target: impl Into<SurfaceTarget<'static>>,
width: u32,
height: u32,
frame_latency: u32,
) -> Result<Self, RenderError>
pub fn new( ctx: &RenderContext, target: impl Into<SurfaceTarget<'static>>, width: u32, height: u32, frame_latency: u32, ) -> Result<Self, RenderError>
Attach a secondary surface for target to ctx’s device.
frame_latency is the swapchain’s desired_maximum_frame_latency,
clamped to 1..=3 — the range AUX_FRAME_LATENCY holds, whose doc
comment carries why those bounds (private, hence named rather than
linked). It is a pacing control and not a
picture one: at 1 the surface holds a single in-flight image, so
get_current_texture waits for this surface’s own previous present to
retire before it returns — one vblank, spent on whichever thread calls
it. A caller presenting this surface from the same thread as another one
pays that wait inside that thread’s frame.
Fails — rather than panicking or degrading silently — when the surface cannot be configured on the adapter this device was created on. That is the dual-GPU path: a window on a monitor driven by the other GPU may present no format this adapter can write. The caller degrades; the core only reports.
Sourcepub fn present_mode(&self) -> AuxPresentMode
pub fn present_mode(&self) -> AuxPresentMode
The present mode this surface was configured with.
Sourcepub fn counts(&self) -> AuxCounts
pub fn counts(&self) -> AuxCounts
What the present path has done since attach. Reset with the target: the counts describe one open session, not the process.
Sourcepub fn frame_latency(&self) -> u32
pub fn frame_latency(&self) -> u32
The frame latency this surface was configured with, after clamping — so a caller reporting which arm ran quotes the depth the swapchain got rather than the one it asked for.
Sourcepub fn resize(&mut self, device: &Device, width: u32, height: u32)
pub fn resize(&mut self, device: &Device, width: u32, height: u32)
Reconfigure for a new size. A zero dimension is ignored — the window is minimized and the old config stays valid for when it returns.
Sourcepub fn present(
&mut self,
ctx: &RenderContext,
runs: &[TextRun<'_>],
preview: Option<&PreviewTarget>,
) -> Result<(), RenderError>
pub fn present( &mut self, ctx: &RenderContext, runs: &[TextRun<'_>], preview: Option<&PreviewTarget>, ) -> Result<(), RenderError>
Draw runs onto the secondary surface and present it.
Wholly independent of the output’s frame: its own encoder, its own submit, its own present. Nothing here touches the primary swapchain, the scene clock or the dissolve, so a console that stalls or drops a frame cannot alter the pixels the show puts on screen — which the golden suite asserts byte-exactly.
It says nothing about when. This runs on the display thread, so its
cost is inside the caller’s frame whatever this surface’s present mode
is; the separation above is of state, not of time. What that costs
is measured rather than argued — Plan 0147 Phase 4, five arms in three
frame-time regimes on an integrated Radeon, found it inside noise, with
AuxCounts beside each arm to prove the presents happened.
Every exit counts itself into AuxCounts: the four surface states
that skip return the same Ok(()) a present does, so without the
counter a caller cannot tell a console that ran from one that never
acquired a texture. The validation arm counts as a skip too — it is the
only exit that returns Err, and leaving it uncounted would break the
caller’s reconciliation by one frame on exactly the frame the console
dies.