Skip to content

Commit

Permalink
Workaround timeout bug on intel devices as well
Browse files Browse the repository at this point in the history
  • Loading branch information
nicopap committed Sep 26, 2022
1 parent 8d7d934 commit a14a344
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions crates/bevy_render/src/view/window.rs
Expand Up @@ -179,16 +179,20 @@ pub fn prepare_windows(
render_device.configure_surface(surface, &swap_chain_descriptor);
}
// A recurring issue is hitting `wgpu::SurfaceError::Timeout` on certain Linux
// AMD drivers. This seems to be a quirk of the driver.
// We'd rather keep panicking when not on Linux AMD, because in those case,
// mesa driver implementations. This seems to be a quirk of some drivers.
// We'd rather keep panicking when not on Linux mesa, because in those case,
// the `Timeout` is still probably the symptom of a degraded unrecoverable
// application state.
// see https://github.com/bevyengine/bevy/pull/5957
// and https://github.com/gfx-rs/wgpu/issues/1218
#[cfg(target_os = "linux")]
let is_amd = || {
let may_erroneously_timeout = || {
render_instance
.enumerate_adapters(wgpu::Backends::VULKAN)
.any(|adapter| adapter.get_info().name.starts_with("AMD"))
.any(|adapter| {
let name = adapter.get_info().name;
name.starts_with("AMD") || name.starts_with("Intel")
})
};

match surface.get_current_texture() {
Expand All @@ -203,10 +207,10 @@ pub fn prepare_windows(
window.swap_chain_texture = Some(TextureView::from(frame));
}
#[cfg(target_os = "linux")]
Err(wgpu::SurfaceError::Timeout) if is_amd() => {
Err(wgpu::SurfaceError::Timeout) if may_erroneously_timeout() => {
debug!(
"Couldn't get swap chain texture. This is probably a quirk \
of your Linux AMD GPU driver, so it can be safely ignored."
of your Linux GPU driver, so it can be safely ignored."
);
}
Err(err) => {
Expand Down

0 comments on commit a14a344

Please sign in to comment.