-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't panic when wgpu swapchain frame is outdated #667
Conversation
We figured out this issue is caused by the fact that X11 events are sent asynchronously. So there is no way to ensure that a resize event won't be sent during the time between We added a fix to |
Happen to me on winit multiple times as well, so it would be nice to get this merged |
It turns out, some NVidia drivers on Linux will also panic like this right when the applications starts. This only appears to happen when the window is a parented window, such as audio plugins made with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left some suggestions, aside from that, looks great. Good job!
examples/integration/src/main.rs
Outdated
wgpu::SwapChainError::Outdated => { | ||
// Try rendering again next frame. | ||
window.request_redraw(); | ||
} | ||
_ => panic!("Swapchain error: {:?}", error), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we handle the other errors? I think the only error that makes sense to panic is OutOfMemory
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this makes sense.
graphics/src/window/compositor.rs
Outdated
@@ -49,5 +52,5 @@ pub trait Compositor: Sized { | |||
background_color: Color, | |||
output: &<Self::Renderer as iced_native::Renderer>::Output, | |||
overlay: &[T], | |||
) -> mouse::Interaction; | |||
) -> Result<mouse::Interaction, ()>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a proper error type here would make sense, maybe just copy SwapChainError
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe? I think that the SwapChainError
is only specific to wgpu
though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, yeah that could work. I've made those changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @BillyDM! And great suggestions, @derezzedex.
Thank you both and sorry for the wait! 🙇
The compositor in
iced_wgpu
should not panic when the wgpu swapchain returns an outdated error, which can happen when the window is resized. Instead, simply try drawing again the next frame.I haven't encountered this issue much with the
winit
version of iced, but it is happening consistently with my owniced_baseview
backend. Could be differences in timing.Fixes #799.