From 889055fb70e6b233c56fca37db5a23c6a217b3e7 Mon Sep 17 00:00:00 2001 From: David Stern Date: Sun, 7 Dec 2025 11:42:13 -0500 Subject: [PATCH] Make some surface operation errors non-fatal. (#8622) --- wgpu/src/backend/wgpu_core.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/wgpu/src/backend/wgpu_core.rs b/wgpu/src/backend/wgpu_core.rs index c6e881d62..aa185f5d1 100644 --- a/wgpu/src/backend/wgpu_core.rs +++ b/wgpu/src/backend/wgpu_core.rs @@ -621,6 +621,7 @@ pub struct CoreTlas { pub struct CoreSurfaceOutputDetail { context: ContextWgpuCore, surface_id: wgc::id::SurfaceId, + error_sink: ErrorSink, } type ErrorSink = Arc>; @@ -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"); + } } }