Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Fixes minimization crash because of cluster updates. #3369

Closed
wants to merge 4 commits into from

Conversation

StarArawn
Copy link
Contributor

Objective

Fixes: #3368

Issue was caused by screen size being: (0, 0).

Solution

Don't update clusters if the screen size is zero. A better solution might be to not render when minimized, but this works in the meantime.

@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Dec 17, 2021
@mockersf mockersf added A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior and removed S-Needs-Triage This issue needs to be labelled labels Dec 17, 2021
Use continue instead of return.

Co-authored-by: François <[email protected]>
@StarArawn StarArawn requested a review from mockersf December 18, 2021 12:55
@rparrett
Copy link
Contributor

I can come back with a proper repro later today, but this divide by zero seems to happen in light.rs if a window dimension is <= ~8, so there are some scenarios that still crash with this PR.

For one repro, add

            resize_constraints: WindowResizeConstraints {
                min_width: 0.0,
                min_height: 0.0,
                ..Default::default()
            },

to bevymark and slowly resize until crash.

@@ -359,6 +359,10 @@ pub fn update_clusters(windows: Res<Windows>, mut views: Query<(&Camera, &mut Cl
let inverse_projection = camera.projection_matrix.inverse();
let window = windows.get(camera.window).unwrap();
let screen_size_u32 = UVec2::new(window.physical_width(), window.physical_height());
// Don't update clusters if screen size is 0.
if screen_size_u32 == UVec2::ZERO {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be more robust to check if either dimension is 0?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try get that changed soon.

@rparrett
Copy link
Contributor

rparrett commented Dec 18, 2021

The crash I was seeing seems to be a separate issue with extreme aspect ratios. I'll open another issue later.

@cart
Copy link
Member

cart commented Dec 20, 2021

bors r+

bors bot pushed a commit that referenced this pull request Dec 20, 2021
# Objective
Fixes: #3368

Issue was caused by screen size being: `(0, 0)`.

## Solution
Don't update clusters if the screen size is zero. A better solution might be to not render when minimized, but this works in the meantime.


Co-authored-by: John <[email protected]>
@bors bors bot changed the title Fixes minimization crash because of cluster updates. [Merged by Bors] - Fixes minimization crash because of cluster updates. Dec 20, 2021
@bors bors bot closed this Dec 20, 2021
mockersf pushed a commit to mockersf/bevy that referenced this pull request Dec 21, 2021
# Objective
Fixes: bevyengine#3368

Issue was caused by screen size being: `(0, 0)`.

## Solution
Don't update clusters if the screen size is zero. A better solution might be to not render when minimized, but this works in the meantime.


Co-authored-by: John <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Minimising panics again
5 participants