From aeacef705a7d22b02b95d858beeab1007b0dcbb1 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 18 Dec 2023 13:19:11 +0100 Subject: [PATCH] Improve input latency by switching to double-buffered rendering This makes a huge difference in perceived latency on my 60 Hz monitor on macOS on a native build, e.g. when hovering buttons, or just the distance between the cursor and the hover-window when hovering an image. It does produce some tearing, noticable e.g. when quickly panning a 2D image. To me the trade-off is absolutely worth it: tearing is a mild visual glitch that shows up occationally, input latency is a constant irritation, making an application feel sluggish. It makes no difference on web though, so this does NOT solve https://github.com/rerun-io/rerun/issues/2672 --- crates/re_viewer/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/re_viewer/src/lib.rs b/crates/re_viewer/src/lib.rs index d8570a645264..410f17a7d27a 100644 --- a/crates/re_viewer/src/lib.rs +++ b/crates/re_viewer/src/lib.rs @@ -154,6 +154,10 @@ pub(crate) fn wgpu_options() -> egui_wgpu::WgpuConfiguration { }), supported_backends: re_renderer::config::supported_backends(), device_descriptor: std::sync::Arc::new(|adapter| re_renderer::config::DeviceCaps::from_adapter(adapter).device_descriptor()), + + present_mode: wgpu::PresentMode::AutoNoVsync, // double-buffered: low-latency, may have tearing + // present_mode: wgpu::PresentMode::AutoVsync, // triple-buffered: high-latency, no tearing + ..Default::default() } }