bevy/crates/bevy_pbr/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
..
cluster fix: Skip some rendering logics when the viewport width or height is zero (#15654) 2024-10-08 22:52:19 +00:00
deferred Fix deferred rendering (#15656) 2024-10-04 22:51:23 +00:00
light Synchronize removed components with the render world (#15582) 2024-10-08 22:23:17 +00:00
light_probe Synchronize removed components with the render world (#15582) 2024-10-08 22:23:17 +00:00
lightmap Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
meshlet Per-meshlet compressed vertex data (#15643) 2024-10-08 18:42:55 +00:00
prepass Synchronize removed components with the render world (#15582) 2024-10-08 22:23:17 +00:00
render Synchronize removed components with the render world (#15582) 2024-10-08 22:23:17 +00:00
ssao Synchronize removed components with the render world (#15582) 2024-10-08 22:23:17 +00:00
ssr Migrate motion blur, TAA, SSAO, and SSR to required components (#15572) 2024-10-01 22:45:31 +00:00
volumetric_fog Synchronize removed components with the render world (#15582) 2024-10-08 22:23:17 +00:00
bundle.rs Synchronize removed components with the render world (#15582) 2024-10-08 22:23:17 +00:00
extended_material.rs Simpler lint fixes: makes ci lints work but disables a lint for now (#15376) 2024-09-24 11:42:59 +00:00
fog.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
lib.rs Synchronize removed components with the render world (#15582) 2024-10-08 22:23:17 +00:00
material.rs Add Order Independent Transparency (#14876) 2024-10-07 23:50:28 +00:00
mesh_material.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
parallax.rs bevy_reflect: FromReflect Ergonomics Implementation (#6056) 2023-06-29 01:31:34 +00:00
pbr_material.rs Simpler lint fixes: makes ci lints work but disables a lint for now (#15376) 2024-09-24 11:42:59 +00:00
wireframe.rs Revert "Have EntityCommands methods consume self for easier chaining" (#15523) 2024-10-02 12:47:26 +00:00