Skip to main content

AuxTarget

Struct AuxTarget 

Source
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

Source

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.

Source

pub fn present_mode(&self) -> AuxPresentMode

The present mode this surface was configured with.

Source

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.

Source

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.

Source

pub fn size(&self) -> (u32, u32)

The surface’s current size in physical pixels.

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,