Expand description
Pluggable vsync pacing seam (VsyncPacer) and zero-allocation portable pacers
(TimerVsyncPacer, ManualVsyncPacer).
All timestamps and intervals use u64 / u32 microseconds so this module compiles cleanly on
wasm32-unknown-unknown without std::time::Instant.
Production consumers implementing VsyncPacer ([INV:extension-point-has-consumers]):
packages/backends/skia-desktop(CADisplayLink/CVDisplayLink,DwmFlush, Waylandwinit, timer fallback)packages/backends/web-runtime(RafVsyncPaceroverwindow.requestAnimationFrame)
Structs§
- Manual
Vsync Handle - Shared atomic control handle paired with
ManualVsyncPacerfor deterministic tests. - Manual
Vsync Pacer - Deterministic, zero-allocation push-driven
VsyncPacerfor unit and integration tests. - Timer
Vsync Pacer - Portable, zero-allocation refresh-rate timer pacer computing
next_deadline_usin microseconds for event loops that sleep viaWaitUntil.
Constants§
- DEFAULT_
REFRESH_ RATE_ MILLIHERTZ - Fallback display refresh rate when the OS/monitor does not report one (60 Hz = 60,000 mHz).
- MAX_
REFRESH_ RATE_ MILLIHERTZ - Maximum accepted refresh rate in millihertz (1000 Hz); higher values clamp here so
interval_us_from_millihertzis strictly>= 1microsecond. - MIN_
REFRESH_ RATE_ MILLIHERTZ - Minimum accepted refresh rate in millihertz (1 Hz); lower values clamp to
DEFAULT_REFRESH_RATE_MILLIHERTZ.
Traits§
- Vsync
Pacer - Platform-pluggable vsync / frame pacing strategy.
Functions§
- interval_
us_ from_ millihertz - Converts a refresh rate in millihertz (e.g.
60_000for 60 Hz,120_000for 120 Hz) into a nominal frame interval in microseconds (16_666us for 60 Hz,8_333us for 120 Hz), guaranteed strictly>= 1. - sanitize_
refresh_ rate_ millihertz - Clamps
millihertzinto a valid refresh rate (< 1_000->60_000,> 1_000_000->1_000_000).