diff --git a/crates/bevy_render/src/view/window/mod.rs b/crates/bevy_render/src/view/window/mod.rs index cb1a4b2df84b3..dd9c7b15331a5 100644 --- a/crates/bevy_render/src/view/window/mod.rs +++ b/crates/bevy_render/src/view/window/mod.rs @@ -304,18 +304,12 @@ pub fn prepare_windows( }) }; - // Linux Nvidia 550.54.14 driver introduced a change, where it returns - // `wgpu::SurfaceError::Outdated` after the window is resized and - // configure called. It can be ignored. #[cfg(target_os = "linux")] - let ignore_outdated = || { + let is_nvidia = || { render_instance .enumerate_adapters(wgpu::Backends::VULKAN) .iter() - .any(|adapter| { - let info = adapter.get_info(); - info.name.starts_with("NVIDIA") && info.driver_info.starts_with("550") - }) + .any(|adapter| adapter.get_info().name.starts_with("NVIDIA")) }; window_surfaces.configured_windows.insert(window.entity); @@ -325,14 +319,19 @@ pub fn prepare_windows( Ok(frame) => { window.set_swapchain_texture(frame); } + #[cfg(target_os = "linux")] + Err(wgpu::SurfaceError::Outdated) if is_nvidia() => { + bevy_utils::tracing::trace!( + "Couldn't get swap chain texture. This often happens with Linux \ + Nvidia 550 driver when resizing, but can be ignored." + ); + } Err(wgpu::SurfaceError::Outdated) => { render_device.configure_surface(surface, &surface_data.configuration); - match surface.get_current_texture() { - Ok(frame) => window.set_swapchain_texture(frame), - #[cfg(target_os = "linux")] - Err(wgpu::SurfaceError::Outdated) if ignore_outdated() => {} - Err(err) => panic!("Error reconfiguring surface: {err}"), - } + let frame = surface + .get_current_texture() + .expect("Error reconfiguring surface"); + window.set_swapchain_texture(frame); } #[cfg(target_os = "linux")] Err(wgpu::SurfaceError::Timeout) if may_erroneously_timeout() => {