1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 22:01:47 +03:00

wayland: fix webgpu invalidation issue

For whatever reason, it appears as though the wayland
frame event stuff is unreliable when used with webgpu,
so we simply avoid using it.

refs: https://github.com/wez/wezterm/issues/3126
This commit is contained in:
Wez Furlong 2023-04-07 22:15:07 -07:00
parent 6bd3664d3d
commit 36d5307b80
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387
2 changed files with 21 additions and 10 deletions

View File

@ -131,6 +131,9 @@ As features stabilize some brief notes about them will accumulate here.
take precedence over built-in rules. #3456
* Painted pane background color behind the tab bar when there was only one
pane. Matters when the tab bar is transparent! #3450
* Wayland: window not repainting consistently when using the keyboard when
using `front_end="WebGpu"`. Thanks to @jokeyrhyme for working through
different iterations of this fix! #3126
### 20230326-111934-3666303c

View File

@ -803,17 +803,25 @@ impl WaylandWindowInner {
self.invalidated = false;
self.events.dispatch(WindowEvent::NeedRepaint);
// Ask the compositor to wake us up when its time to paint
// the next frame
let window_id = self.window_id;
let callback = self.surface.frame();
callback.quick_assign(move |_source, _event, _data| {
WaylandConnection::with_window_inner(window_id, |inner| {
inner.next_frame_is_ready();
Ok(())
if self.gl_state.is_some() {
// Ask the compositor to wake us up when it is time to paint
// the next frame.
// We don't do this when we're using WebGPU because we don't
// always get a timely wakeup. We configure wgpu to use a
// vsync-equivalent PresentMode so we should already be
// respecting the maximum frame rate, making it less critical
// to rely on Wayland's frame scheduling.
// <https://github.com/wez/wezterm/issues/3126>
let window_id = self.window_id;
let callback = self.surface.frame();
callback.quick_assign(move |_source, _event, _data| {
WaylandConnection::with_window_inner(window_id, |inner| {
inner.next_frame_is_ready();
Ok(())
});
});
});
self.frame_callback.replace(callback);
self.frame_callback.replace(callback);
}
Ok(())
}