summaryrefslogtreecommitdiff
path: root/alligator_render/src/renderer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'alligator_render/src/renderer.rs')
-rw-r--r--alligator_render/src/renderer.rs28
1 files changed, 16 insertions, 12 deletions
diff --git a/alligator_render/src/renderer.rs b/alligator_render/src/renderer.rs
index 27e7884..ee507bd 100644
--- a/alligator_render/src/renderer.rs
+++ b/alligator_render/src/renderer.rs
@@ -385,19 +385,23 @@ impl Renderer {
}
Event::MainEventsCleared => {
f(&mut self);
- match self.render() {
- Ok(_) => {}
- // reconfigure the surface if it's been lost
- Err(wgpu::SurfaceError::Lost) => {
- self.reconfigure();
- }
- // if we ran out of memory, then we'll die
- Err(wgpu::SurfaceError::OutOfMemory) => {
- *control_flow = ControlFlow::ExitWithCode(1);
+ if self.window.inner_size().width != 0 && self.window.inner_size().height != 0 {
+ match self.render() {
+ Ok(_) => {}
+ // reconfigure the surface if it's been lost
+ Err(wgpu::SurfaceError::Lost) => {
+ self.reconfigure();
+ }
+ // if we ran out of memory, then we'll die
+ Err(wgpu::SurfaceError::OutOfMemory) => {
+ *control_flow = ControlFlow::ExitWithCode(1);
+ }
+ // otherwise, we'll just log the error
+ Err(e) => log::error!("{}", e),
}
- // otherwise, we'll just log the error
- Err(e) => log::error!("{}", e),
- };
+ } else {
+ *control_flow = ControlFlow::Wait;
+ }
profiling::finish_frame!();
}
_ => {}