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

Regression: wgpu panic on window minimize #4097

Open
aevyrie opened this issue Mar 4, 2022 · 3 comments
Open

Regression: wgpu panic on window minimize #4097

aevyrie opened this issue Mar 4, 2022 · 3 comments
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior P-Regression Functionality that used to work but no longer does. Add a test for this!

Comments

@aevyrie
Copy link
Member

aevyrie commented Mar 4, 2022

Bevy version

Regression occurs in 81d57e1 as a result of #3412

This bug is not present in 0.6.1, or any commits prior to the above PR merge.

Operating system & version

Win 11

What you did

Minimize an example window.

What you expected to happen

Nothing

What actually happened

thread 'main' panicked at 'wgpu error: Validation Error

Caused by:
    In Device::create_texture
      note: label = `sampled_color_attachment_texture`
    Dimension X is zero
wgpu-0.12.0\src\backend\direct.rs:2273:5
@aevyrie aevyrie added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen P-Regression Functionality that used to work but no longer does. Add a test for this! labels Mar 4, 2022
@aevyrie
Copy link
Member Author

aevyrie commented Mar 4, 2022

@HackerFoo you are most likely to know where this is coming from. 🙂

We've seen this bug in the past, caused by the height being set to zero. See #2299 for links to even more similar issues.

@HackerFoo
Copy link
Contributor

I'm looking into it. I was able to reproduce the bug on MacOS using:

diff --git a/crates/bevy_window/src/window.rs b/crates/bevy_window/src/window.rs
index 47c03d085..ae34badc6 100644
--- a/crates/bevy_window/src/window.rs
+++ b/crates/bevy_window/src/window.rs
@@ -418,8 +418,14 @@ impl Window {
     #[allow(missing_docs)]
     #[inline]
     pub fn update_actual_size_from_backend(&mut self, physical_width: u32, physical_height: u32) {
-        self.physical_width = physical_width;
-        self.physical_height = physical_height;
+        println!("update {physical_width}, {physical_height}");
+        if physical_width < 400 || physical_height < 400 {
+            self.physical_width = 0;
+            self.physical_height = 0;
+        } else {
+            self.physical_width = physical_width;
+            self.physical_height = physical_height;
+        }
     }

     #[allow(missing_docs)]

and then shrinking the 3d_scene example window until it crashes.

bors bot pushed a commit that referenced this issue Apr 15, 2022
# Objective

Fix #4097

## Solution

Return `None` from `RenderTarget::get_physical_size` if either dimension is zero.
aevyrie pushed a commit to aevyrie/bevy that referenced this issue Jun 7, 2022
# Objective

Fix bevyengine#4097

## Solution

Return `None` from `RenderTarget::get_physical_size` if either dimension is zero.
@thrombe
Copy link

thrombe commented Oct 15, 2022

i hit the same panic just by resizing the window when fit_canvas_to_parent is set to true.

Caused by:
    In Device::create_texture
      note: label = `sampled_color_attachment_texture`
    Dimension Y value 2050 exceeds the limit of 2048

', wgpu-0.13.1/src/backend/direct.rs:2391:5

ItsDoot pushed a commit to ItsDoot/bevy that referenced this issue Feb 1, 2023
# Objective

Fix bevyengine#4097

## Solution

Return `None` from `RenderTarget::get_physical_size` if either dimension is zero.
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 P-Regression Functionality that used to work but no longer does. Add a test for this!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants