Skip to content

Commit

Permalink
Improve input latency by switching to double-buffered rendering
Browse files Browse the repository at this point in the history
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 #2672
  • Loading branch information
emilk committed Dec 18, 2023
1 parent 471af6d commit aeacef7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/re_viewer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down

0 comments on commit aeacef7

Please sign in to comment.