From 8bd1bdfaa862af383c4134137df9e4ec7874c838 Mon Sep 17 00:00:00 2001 From: Arman Uguray Date: Thu, 16 Mar 2023 09:28:42 -0700 Subject: [PATCH] [frame_stats] Use wgpu::PresentMode::AutoVsync/AutoNoVsync for VSync mode The Auto* modes should have wider compatibility as they implement fallback behavior based on what the platform supports. This also means that on web "vsync off" will likely be incorrect. --- examples/with_winit/src/lib.rs | 4 ++-- src/util.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/with_winit/src/lib.rs b/examples/with_winit/src/lib.rs index 5e023e6..2536e4c 100644 --- a/examples/with_winit/src/lib.rs +++ b/examples/with_winit/src/lib.rs @@ -158,9 +158,9 @@ fn run( render_cx.set_present_mode( &mut render_state.surface, if vsync_on { - wgpu::PresentMode::Fifo + wgpu::PresentMode::AutoVsync } else { - wgpu::PresentMode::Immediate + wgpu::PresentMode::AutoNoVsync }, ); } diff --git a/src/util.rs b/src/util.rs index d73778a..87e2d35 100644 --- a/src/util.rs +++ b/src/util.rs @@ -70,7 +70,7 @@ impl RenderContext { format, width, height, - present_mode: wgpu::PresentMode::Fifo, + present_mode: wgpu::PresentMode::AutoVsync, alpha_mode: wgpu::CompositeAlphaMode::Auto, view_formats: vec![], };