Make some surface operation errors non-fatal. (#8622)

This commit is contained in:
David Stern authored and GitHub committed 2025-12-07 17:42:13 +01:00
1 parent 90db08157c
commit 889055fb70
1 file changed
+13 -2
+13 -2
View File
@@ -621,6 +621,7 @@ pub struct CoreTlas {
pub struct CoreSurfaceOutputDetail {
context: ContextWgpuCore,
surface_id: wgc::id::SurfaceId,
error_sink: ErrorSink,
}
type ErrorSink = Arc<Mutex<ErrorSinkRaw>>;
@@ -3875,9 +3876,16 @@ impl dispatch::SurfaceInterface for CoreSurface {
crate::SurfaceStatus,
dispatch::DispatchSurfaceOutputDetail,
) {
let error_sink = if let Some(error_sink) = self.error_sink.lock().as_ref() {
error_sink.clone()
} else {
Arc::new(Mutex::new(ErrorSinkRaw::new()))
};
let output_detail = CoreSurfaceOutputDetail {
context: self.context.clone(),
surface_id: self.id,
error_sink: error_sink.clone(),
}
.into();
@@ -3890,7 +3898,7 @@ impl dispatch::SurfaceInterface for CoreSurface {
.map(|id| CoreTexture {
context: self.context.clone(),
id,
error_sink: Arc::new(Mutex::new(ErrorSinkRaw::new())),
error_sink,
})
.map(Into::into);
@@ -3926,7 +3934,10 @@ impl dispatch::SurfaceOutputDetailInterface for CoreSurfaceOutputDetail {
fn present(&self) {
match self.context.0.surface_present(self.surface_id) {
Ok(_status) => (),
Err(err) => self.context.handle_error_fatal(err, "Surface::present"),
Err(err) => {
self.context
.handle_error_nolabel(&self.error_sink, err, "Surface::present");
}
}
}