diff --git a/crates/comet_app/Cargo.toml b/crates/comet_app/Cargo.toml index 59bd1f5..4965b46 100755 --- a/crates/comet_app/Cargo.toml +++ b/crates/comet_app/Cargo.toml @@ -18,6 +18,7 @@ pollster = "0.3" winit_input_helper = "0.16.0" crossbeam-channel = "0.5.14" chrono = "0.4.40" +wgpu = "22.0" [dependencies.image] version = "0.24" diff --git a/crates/comet_app/src/app.rs b/crates/comet_app/src/app.rs index 888fc2a..2f3d23a 100755 --- a/crates/comet_app/src/app.rs +++ b/crates/comet_app/src/app.rs @@ -387,7 +387,19 @@ impl App { window.request_redraw(); match renderer.render() { Ok(_) => {} - Err(e) => error!("Error rendering: {}", e), + Err( + wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated, + ) => { + let size = renderer.size(); + renderer.resize(size); + } + Err(wgpu::SurfaceError::OutOfMemory) => { + error!("Out of memory!"); + elwt.exit(); + } + Err(wgpu::SurfaceError::Timeout) => { + warn!("Surface timeout - skipping frame"); + } } } _ => {}