Fix wgpu-runner validation errors on minimize
Vulkan swap chains must have non-zero dimensions, this adds a check for that during swap chain resizing and does not create one if it would be invalid.
@@ -149,12 +149,17 @@ async fn run(
event: WindowEvent::Resized(size),
..
} => {
+ if size.width != 0 && size.height != 0 {
// Recreate the swap chain with the new size
sc_desc.width = size.width;
sc_desc.height = size.height;
if let Some(surface) = &surface {
swap_chain = Some(device.create_swap_chain(surface, &sc_desc));
}
+ } else {
+ // Swap chains must have non-zero dimensions
+ swap_chain = None;
+ }
}
Event::RedrawRequested(_) => {
if let Some(swap_chain) = &mut swap_chain {
