bevy/crates/bevy_core_pipeline/src
Shoyu Vanilla (Flint) a89ae8e9d9
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;


25bfa80e60/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
2024-10-08 22:52:19 +00:00
..
auto_exposure Synchronize removed components with the render world (#15582) 2024-10-08 22:23:17 +00:00
blit Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bloom fix: Skip some rendering logics when the viewport width or height is zero (#15654) 2024-10-08 22:52:19 +00:00
contrast_adaptive_sharpening Simpler lint fixes: makes ci lints work but disables a lint for now (#15376) 2024-09-24 11:42:59 +00:00
core_2d Synchronize removed components with the render world (#15582) 2024-10-08 22:23:17 +00:00
core_3d Synchronize removed components with the render world (#15582) 2024-10-08 22:23:17 +00:00
deferred Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
dof Synchronize removed components with the render world (#15582) 2024-10-08 22:23:17 +00:00
fullscreen_vertex_shader Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
fxaa Simpler lint fixes: makes ci lints work but disables a lint for now (#15376) 2024-09-24 11:42:59 +00:00
motion_blur Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
oit Use shader_def for oit resolve layer count (#15747) 2024-10-08 22:40:17 +00:00
post_process Start a built-in postprocessing stack, and implement chromatic aberration in it. (#13695) 2024-07-15 13:59:02 +00:00
prepass Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
skybox Allow to expect (adopted) (#15301) 2024-09-20 19:16:42 +00:00
smaa Rename rendering components for improved consistency and clarity (#15035) 2024-09-10 01:11:46 +00:00
taa Synchronize removed components with the render world (#15582) 2024-10-08 22:23:17 +00:00
tonemapping Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
upscaling Simpler lint fixes: makes ci lints work but disables a lint for now (#15376) 2024-09-24 11:42:59 +00:00
lib.rs Fix oit webgl (#15728) 2024-10-08 14:50:35 +00:00
msaa_writeback.rs Simpler lint fixes: makes ci lints work but disables a lint for now (#15376) 2024-09-24 11:42:59 +00:00