mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-30 04:57:54 -06:00
`wgpu_options` built the window's configuration from `WgpuConfiguration::default()`, whose surface is `SurfaceConfig::HIGH_THROUGHPUT` (two frames in flight); eframe's own `NativeOptions::default()` wraps it with `LOW_LATENCY` (one), and replacing `wgpu_options` wholesale silently lost that. On Metal, wgpu-hal sets `maximumDrawableCount = latency + 1`: three drawables instead of two, one more frame between the pointer and the screen on every drag, scrub and slider (8 ms at 120 Hz, 17 ms at 60 Hz). Start from `.with_surface_config(eframe::SurfaceConfig::LOW_LATENCY)`; everything else in `wgpu_options` is unchanged. Measured on an M2 Max (release, `footprint -p`): IOSurface 61 MB → 41 MB (three 21 MB drawables → two). Interface frame rate during 10 s of playback of a 1080p comp whose frames cost 164–279 ms on the GPU stays at 120 fps either way (median 120.1 vs 120.0, p10 116–119.5 vs 117–119.4), so one frame in flight does not starve this comp at 120 Hz. Test: `the_window_surface_is_low_latency` asserts `LOW_LATENCY`, `desired_maximum_frame_latency == Some(1)` and `AutoVsync` for every backend choice, and equality with eframe's default surface. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>