Skip to content

Commit d26ae5b

Browse files
committed
wayland: Fix buffer age
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.
1 parent ef49741 commit d26ae5b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: src/wayland/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,14 @@ impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> WaylandImpl<D, W> {
186186
.dispatch_pending(&mut State);
187187

188188
if let Some((front, back)) = &mut self.buffers {
189+
// Swap front and back buffer
190+
std::mem::swap(front, back);
191+
189192
front.age = 1;
190193
if back.age != 0 {
191194
back.age += 1;
192195
}
193196

194-
// Swap front and back buffer
195-
std::mem::swap(front, back);
196-
197197
front.attach(self.surface.as_ref().unwrap());
198198

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

0 commit comments

Comments
 (0)