mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-20 22:41:07 +01:00
Removed erroneous zero size check related conditional in water example resize() (#534)
* The conditional at the start of resize() already tests for and exits on the zero width and height condition. The conditional removed here was then getting run on every other call to resize(), which doesn't seem logical, doesn't correspond to the comment, and seemed to be causing at least one issue with rendered viewport going black during resize. Fixes #532 (probably) Fixes #519 * Defensive coding to prevent various issues when window size goes to zero, e.g. NaN being passed in cgmath::perspective() aspect ratio parameter. Fixes #531
This commit is contained in:
1 parent
7396e92fcb
commit
1935cfa28a
2 files changed
+3
-8
No files matched your search
@@ -250,8 +250,8 @@ fn start<E: Example>(
|
||||
..
|
||||
} => {
|
||||
log::info!("Resizing to {:?}", size);
|
||||
sc_desc.width = size.width;
|
||||
sc_desc.height = size.height;
|
||||
sc_desc.width = if size.width == 0 { 1 } else { size.width };
|
||||
sc_desc.height = if size.height == 0 { 1 } else { size.height };
|
||||
example.resize(&sc_desc, &device, &queue);
|
||||
swap_chain = device.create_swap_chain(&surface, &sc_desc);
|
||||
}
|
||||
|
||||
@@ -648,13 +648,8 @@ impl framework::Example for Example {
|
||||
// Stop rendering altogether.
|
||||
self.active = None;
|
||||
return;
|
||||
} else {
|
||||
// The next frame queued is the wrong size: (0, 0),
|
||||
// so we skip a frame to avoid crashes where our
|
||||
// textures are the correct (window) size, and the
|
||||
// frame is still (0, 0).
|
||||
self.active = Some(self.current_frame + 1);
|
||||
}
|
||||
self.active = Some(self.current_frame);
|
||||
|
||||
// Regenerate all of the buffers and textures.
|
||||
|
||||
|
||||
Reference in new issue
Block a user