pub struct PumpClient { /* private fields */ }Expand description
Cheap cloneable handle for per-frame pump operations: resize,
frame acquire, present. The editor’s backend keeps one; the
SurfacePump owner keeps the lifecycle.
Implementations§
Source§impl PumpClient
impl PumpClient
Sourcepub fn resize(&self, phys_w: u32, phys_h: u32)
pub fn resize(&self, phys_w: u32, phys_h: u32)
Reconfigure the surface (physical pixels). On Windows this is queued latest-wins - a resize burst costs one configure once the pump gets to it, and any pre-acquired frame at the old size is discarded. Elsewhere it configures inline.
Sourcepub fn try_take_frame(&self) -> Option<SurfaceTexture>
pub fn try_take_frame(&self) -> Option<SurfaceTexture>
Get a frame to paint into. None means skip this paint and
keep the dirty state - retry on a later tick. Callers should
verify the texture’s size still matches their target and
discard (drop) it if a resize raced in.
Windows: takes the pre-acquired frame if ready, arming the pump to acquire the next one either way - never blocks. Elsewhere: acquires inline (recovering from a stale surface by reconfiguring), exactly as the editors did before the pump.
Sourcepub fn present(&self, frame: SurfaceTexture)
pub fn present(&self, frame: SurfaceTexture)
Present a painted frame (handed back to the pump thread on Windows, presented inline elsewhere).
Sourcepub fn discard(&self, frame: SurfaceTexture)
pub fn discard(&self, frame: SurfaceTexture)
Release a taken frame that won’t be painted (stale size after a raced resize, or an aborted paint), so the pump may acquire again - wgpu allows only one outstanding acquired texture per surface. On Windows the frame is presented unrendered rather than dropped: DX12 replenishes the frame-latency waitable only on present, and a dropped acquire burns a slot until every acquire blocks wgpu’s full 1 s timeout. The recycled old-frame content matches what the compositor is already showing mid-churn.
Sourcepub fn is_ready(&self) -> bool
pub fn is_ready(&self) -> bool
Whether GPU init has completed and frames can be served. Always
true on the inline platforms (init ran synchronously in
spawn).
Sourcepub fn last_acquire_wait(&self) -> Duration
pub fn last_acquire_wait(&self) -> Duration
The most recent swapchain-acquire wait, for compositor pacing.
Trait Implementations§
Source§impl Clone for PumpClient
impl Clone for PumpClient
Source§fn clone(&self) -> PumpClient
fn clone(&self) -> PumpClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more