Skip to content

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

Closed
StarArawn wants to merge 4 commits intobevyengine:mainfrom
StarArawn:fix-cluster-minimize
Closed

[Merged by Bors] - Fixes minimization crash because of cluster updates.#3369
StarArawn wants to merge 4 commits intobevyengine:mainfrom
StarArawn:fix-cluster-minimize

Conversation

@StarArawn
Copy link
Copy Markdown
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
Copy Markdown
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.

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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