Skip to content

Commit

Permalink
wayland: Fix buffer age
Browse files Browse the repository at this point in the history
We need to reset the age of the *new* front buffer to 1, not the old
one.

It turns out they're easy to mix up right when you're about to swap
them.
  • Loading branch information
ids1024 committed Jan 9, 2024
1 parent ef49741 commit d26ae5b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/wayland/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,14 @@ impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> WaylandImpl<D, W> {
.dispatch_pending(&mut State);

if let Some((front, back)) = &mut self.buffers {
// Swap front and back buffer
std::mem::swap(front, back);

front.age = 1;
if back.age != 0 {
back.age += 1;
}

// Swap front and back buffer
std::mem::swap(front, back);

front.attach(self.surface.as_ref().unwrap());

// Like Mesa's EGL/WSI implementation, we damage the whole buffer with `i32::MAX` if
Expand Down

0 comments on commit d26ae5b

Please sign in to comment.