-
-
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
Decreasing window height to 0 causes crash #170
Comments
Just to add, on macOS the window height cannot be reduced beyond 1px. |
Thanks for opening this, I experienced the same and I believe it's actually an upstream issue with I ran a EDIT: This bug also exists when running nannou examples on windows |
The assertion appears to come from the cart_tmp_wgc crate, which does not appear to have it's repository set properly, or perhaps the source code was not actually pushed to github. Edit: I assume that's a temporary |
Yup that was a temporary version of the wgpu master branch while we waited for 0.6.0. I'll likely upgrade to the official package today (we already have a branch with the correct changes). |
Same thing too happens for me when I reduce the height of the window to zero. Ran using Windows 10, current Bevy master (0.4.0+)
|
This happens to me too, when i minimize the window.
|
Can be fixed with this diff. @MinerSebas - should I submit this as a PR? All it does is guarantee that the swapchain/texture is at least 1px in height/width. The only other places that the window width/height is referenced in the codebase is:
diff --git a/crates/bevy_render/src/render_graph/nodes/window_texture_node.rs b/crates/bevy_render/src/render_graph/nodes/window_texture_node.rs
index 78242819..de52e564 100644
--- a/crates/bevy_render/src/render_graph/nodes/window_texture_node.rs
+++ b/crates/bevy_render/src/render_graph/nodes/window_texture_node.rs
@@ -68,8 +68,8 @@ impl Node for WindowTextureNode {
render_resource_context.remove_texture(old_texture);
}
- self.descriptor.size.width = window.physical_width();
- self.descriptor.size.height = window.physical_height();
+ self.descriptor.size.width = window.physical_width().max(1);
+ self.descriptor.size.height = window.physical_height().max(1);
let texture_resource = render_resource_context.create_texture(self.descriptor);
output.set(WINDOW_TEXTURE, RenderResourceId::Texture(texture_resource));
}
diff --git a/crates/bevy_wgpu/src/wgpu_type_converter.rs b/crates/bevy_wgpu/src/wgpu_type_converter.rs
index 923900e7..5f6e9a6e 100644
--- a/crates/bevy_wgpu/src/wgpu_type_converter.rs
+++ b/crates/bevy_wgpu/src/wgpu_type_converter.rs
@@ -637,8 +637,8 @@ impl WgpuFrom<&Window> for wgpu::SwapChainDescriptor {
wgpu::SwapChainDescriptor {
usage: wgpu::TextureUsage::RENDER_ATTACHMENT,
format: TextureFormat::default().wgpu_into(),
- width: window.physical_width(),
- height: window.physical_height(),
+ width: window.physical_width().max(1),
+ height: window.physical_height().max(1),
present_mode: if window.vsync() {
wgpu::PresentMode::Fifo
} else { |
@trolleyman This looks like a better solution than just panicking, so submitting a PR would be great! |
there is #1409 that adds this plus a few more things |
@mockersf From a cursory glance, looks like this doesn't fix the problem if users set the minimum height to 0, right? |
That PR has the same Solution, just in another Location: bevy/crates/bevy_winit/src/utils.rs Lines 12 to 13 in 5c888e8
|
Ahh, fair dos, cheers :) |
Though I will say there is a small difference - the new PR disallows users from making 0-sized windows (up for debate how useful that actually is, but still, it's a limitation for users) |
I ran the
sprite
example from master branch (a7f1889) on Windows 10.Resizing the window to minimum height crashed the example:
Tried this in debug/release builds on msvc/gnu toolchains and it happens in every configuration.
The assertion seems to be the in
cart-tmp-wgc/command/render.rs:505
.The text was updated successfully, but these errors were encountered: