Skip to content

Commit

Permalink
Change default PresentMode and update enable_vsync
Browse files Browse the repository at this point in the history
- Fixes #263
  • Loading branch information
parasyte committed Dec 18, 2022
1 parent 9e943dd commit 2e2fa17
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl<'req, 'dev, 'win, W: HasRawWindowHandle + HasRawDisplayHandle>
width,
height,
_pixel_aspect_ratio: 1.0,
present_mode: wgpu::PresentMode::Fifo,
present_mode: wgpu::PresentMode::AutoVsync,
surface_texture,
texture_format: wgpu::TextureFormat::Rgba8UnormSrgb,
render_texture_format: None,
Expand Down Expand Up @@ -125,16 +125,16 @@ impl<'req, 'dev, 'win, W: HasRawWindowHandle + HasRawDisplayHandle>

/// Enable or disable Vsync.
///
/// Vsync is enabled by default.
/// Vsync is enabled by default. It cannot be disabled on Web targets.
///
/// The `wgpu` present mode will be set to `Fifo` when Vsync is enabled, or `Immediate` when
/// Vsync is disabled. To set the present mode to `Mailbox` or another value, use the
/// The `wgpu` present mode will be set to `AutoVsync` when Vsync is enabled, or `AutoNoVsync`
/// when Vsync is disabled. To set the present mode to `Mailbox` or another value, use the
/// [`PixelsBuilder::present_mode`] method.
pub fn enable_vsync(mut self, enable_vsync: bool) -> Self {
self.present_mode = if enable_vsync {
wgpu::PresentMode::Fifo
wgpu::PresentMode::AutoVsync
} else {
wgpu::PresentMode::Immediate
wgpu::PresentMode::AutoNoVsync
};
self
}
Expand Down

0 comments on commit 2e2fa17

Please sign in to comment.