-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Conversation
Use continue instead of return. Co-authored-by: François <mockersf@gmail.com>
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
to bevymark and slowly resize until crash. |
crates/bevy_pbr/src/light.rs
Outdated
@@ -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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me!
There was a problem hiding this comment.
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.
The crash I was seeing seems to be a separate issue with extreme aspect ratios. I'll open another issue later. |
bors r+ |
# 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 <startoaster23@gmail.com>
# 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 <startoaster23@gmail.com>
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.