diff --git a/wgpu/src/backend/wgpu_core.rs b/wgpu/src/backend/wgpu_core.rs index d72865cce52..f00c5b3c909 100644 --- a/wgpu/src/backend/wgpu_core.rs +++ b/wgpu/src/backend/wgpu_core.rs @@ -589,6 +589,7 @@ pub struct CoreTlas { pub struct CoreSurfaceOutputDetail { context: ContextWgpuCore, surface_id: wgc::id::SurfaceId, + error_sink: ErrorSink, } type ErrorSink = Arc>; @@ -3443,9 +3444,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(); @@ -3455,7 +3463,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); @@ -3491,7 +3499,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"); + } } }