Skip to content

Commit

Permalink
Always poll after the first frame has been rendered
Browse files Browse the repository at this point in the history
This ensures that subsequent frames are rendred if needed
  • Loading branch information
fredizzimo committed Dec 6, 2023
1 parent a646304 commit 5c973aa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/window/update_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,11 @@ impl UpdateLoop {
.max(1.0);

let expected_frame_duration = Duration::from_secs_f32(1.0 / refresh_rate);
if self.should_render == ShouldRender::Immediately && !vsync.uses_winit_throttling() {
if self.should_render == ShouldRender::Immediately && !vsync.uses_winit_throttling()
|| self.num_consecutive_rendered == 1
{
// Only poll when using native vsync
// NOTE: Also after the first frame after an idle period has been rendered
(Duration::from_nanos(0), Instant::now())
} else {
let mut deadline = self.previous_frame_start + expected_frame_duration;
Expand Down

0 comments on commit 5c973aa

Please sign in to comment.