Wayland: VSync off draws uncapped in a window

pre_present_notify ties winit's RedrawRequested to the compositor's
frame callbacks on Wayland, one per refresh, so a window drew at the
monitor's rate whatever the present mode. Only Fifo (VSync) asks for
that pacing now; Mailbox and Immediate draw as fast as the frame limit
allows, like vanilla's GLFW window.

Fixes #441

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-16 02:42:22 +02:00
parent d333780478
commit a8e0dead35
+6 -1
View File
@@ -2534,7 +2534,12 @@ impl Renderer {
}
let present = Instant::now();
if let Some(surface_frame) = surface_frame {
self.window.pre_present_notify();
// On Wayland this ties RedrawRequested to the compositor's frame
// callbacks, one per refresh. Only VSync (Fifo) waits for the
// display: with it off, vanilla's window draws uncapped.
if self.config.present_mode == wgpu::PresentMode::Fifo {
self.window.pre_present_notify();
}
self.queue.present(surface_frame);
if reconfigure && let Some(surface) = &self.surface {
surface.configure(&self.device, &self.config);