Don't panic on GPU hang (#14974)

Fixes: #12766
Fixes: #14022

Release Notes:

- linux: Fix panic when GPU is temporarily unavailable.
This commit is contained in:
Conrad Irwin 2024-07-22 12:21:28 -06:00 committed by GitHub
parent f597c29432
commit a955968de3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -18,7 +18,7 @@ use blade_graphics as gpu;
use blade_util::{BufferBelt, BufferBeltDescriptor};
use std::{mem, sync::Arc};
const MAX_FRAME_TIME_MS: u32 = 1000;
const MAX_FRAME_TIME_MS: u32 = 10000;
#[cfg(target_os = "macos")]
pub type Context = ();
@ -412,7 +412,8 @@ impl BladeRenderer {
fn wait_for_gpu(&mut self) {
if let Some(last_sp) = self.last_sync_point.take() {
if !self.gpu.wait_for(&last_sp, MAX_FRAME_TIME_MS) {
panic!("GPU hung");
log::error!("GPU hung");
while !self.gpu.wait_for(&last_sp, MAX_FRAME_TIME_MS) {}
}
}
}