Open v-po opened 1 year ago
Thanks for the report!
This is a known issue - we've discussed it a couple of times on Zulip: https://xi.zulipchat.com/#narrow/stream/197075-gpu/topic/vello.200.2E0.2E1/near/322106970
And: https://xi.zulipchat.com/#narrow/stream/197075-gpu/topic/Zero.20area.20surface.20error.20from.20wgpu
I'm not entirely certain what the best way to fix this is - as mentioned in the first link, the naïve solution of deleting the swapchain feels suboptimal in cases where (e.g.) the alt-tab menu is opened, as I would hope that animations would continue during that, even for minimised windows.
But a contribution to implement the solution of special-casing a resize event where any axis is zero sized to delete the surface would be welcome!
I first encountered this when playing around with the example app in Xilem, and then I saw that the
glazier
examples exhibit the same behavior. I decided to open the issue here because it seems to caused by theRenderContext.resize_surface
method. But maybe this is the desired behavior.wgpu
is complaining that a Surface's width and height must be non-zero, and when a window is minimized (on Windows 11 at least), what seems to be happening is that thesurface_size
calculation from the glazier examples is returning (0, 0).To me, it's not clear what should be the correct behavior here. Whether or not the callers should check the surface's (or window handle's) size before calling
resize_surface
. Although, in this example they are checking the width & height before callingsurface.configure
.From my testing, the crash is only happening on Windows 11, but it's also the only version of Windows I've tried. macOS doesn't seem to have this problem.
Stacktrace
```bash thread 'main' panicked at 'Error in Surface::configure: Validation Error Caused by: Both `Surface` width and height must be non-zero. Wait to recreate the `Surface` until the window has non-zero area. ', C:\Users\dvh\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-0.17.1\src\backend\direct.rs:771:18 stack backtrace: 0: std::panicking::begin_panic_handler at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library\std\src\panicking.rs:593 1: core::panicking::panic_fmt at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library\core\src\panicking.rs:67 2: wgpu::backend::direct::Context::handle_error_fatal