Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Skip some rendering logics when the viewport width or height is…
… zero (#15654) # Objective - Fixes #15285 ## Solution `winit` sends resized to zero events when the window is minimized only on Windows OS(rust-windowing/winit#2015). This makes updating window viewport size to `(0, 0)` and panicking when calculating aspect ratio. ~~So, just skip these kinds of events - resizing to (0, 0) when the window is minimized - on Windows OS~~ Idially, the camera extraction excludes the cameras whose target size width or height is zero here; https://github.com/bevyengine/bevy/blob/25bfa80e60e886031dd6eb1a3fe2ea548fc0a6c6/crates/bevy_render/src/camera/camera.rs#L1060-L1074 but it seems that winit event loop sends resize events after extraction and before post update schedule, so they might panics before the extraction filters them out. Alternatively, it might be possible to change event loop evaluating order or defer them to the right schedule but I'm afraid that it might cause some breaking changes, so just skip rendering logics for such windows and they will be all filtered out by the extractions on the next frame and thereafter. ## Testing Running the example in the original issue and minimizing causes panic, or just running `tests/window/minimising.rs` with `cargo run --example minimising` panics without this PR and doesn't panics with this PR. I think that we should run it in CI on Windows OS btw
- Loading branch information