diff --git a/wgpu/src/window/compositor.rs b/wgpu/src/window/compositor.rs index dab9653100..e95b836ee2 100644 --- a/wgpu/src/window/compositor.rs +++ b/wgpu/src/window/compositor.rs @@ -348,13 +348,26 @@ impl graphics::Compositor for Compositor { background_color: Color, on_pre_present: impl FnOnce(), ) -> Result<(), compositor::SurfaceError> { - present( + let result = present( renderer, surface, viewport, background_color, on_pre_present, - ) + ); + + if let Err( + compositor::SurfaceError::Outdated | compositor::SurfaceError::Lost, + ) = result + { + self.configure_surface( + surface, + viewport.physical_width(), + viewport.physical_height(), + ); + } + + result } fn screenshot(