From fb65e9423b3186ff4091ff4b090f944de144a12c Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 2 Sep 2022 17:04:44 +0200 Subject: [PATCH] Ignore timeout errors --- crates/fj-viewer/src/graphics/renderer.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/crates/fj-viewer/src/graphics/renderer.rs b/crates/fj-viewer/src/graphics/renderer.rs index e695af3a0..092e110a3 100644 --- a/crates/fj-viewer/src/graphics/renderer.rs +++ b/crates/fj-viewer/src/graphics/renderer.rs @@ -324,7 +324,20 @@ impl Renderer { bytemuck::cast_slice(&[uniforms]), ); - let surface_texture = self.surface.get_current_texture()?; + let surface_texture = match self.surface.get_current_texture() { + Ok(surface_texture) => surface_texture, + Err(wgpu::SurfaceError::Timeout) => { + // I'm seeing this all the time now (as in, multiple times per + // microsecond), which `PresentMode::AutoVsync`. Not sure what's + // going on, but for now, it works to just ignore it. + // + // Issues for reference: + // - https://github.com/gfx-rs/wgpu/issues/1218 + // - https://github.com/gfx-rs/wgpu/issues/1565 + return Ok(()); + } + result => result?, + }; let color_view = surface_texture .texture .create_view(&wgpu::TextureViewDescriptor::default());