Skip to content

Commit 889055f

Browse files
authored
Make some surface operation errors non-fatal. (#8622)
1 parent 90db081 commit 889055f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

wgpu/src/backend/wgpu_core.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,7 @@ pub struct CoreTlas {
621621
pub struct CoreSurfaceOutputDetail {
622622
context: ContextWgpuCore,
623623
surface_id: wgc::id::SurfaceId,
624+
error_sink: ErrorSink,
624625
}
625626

626627
type ErrorSink = Arc<Mutex<ErrorSinkRaw>>;
@@ -3875,9 +3876,16 @@ impl dispatch::SurfaceInterface for CoreSurface {
38753876
crate::SurfaceStatus,
38763877
dispatch::DispatchSurfaceOutputDetail,
38773878
) {
3879+
let error_sink = if let Some(error_sink) = self.error_sink.lock().as_ref() {
3880+
error_sink.clone()
3881+
} else {
3882+
Arc::new(Mutex::new(ErrorSinkRaw::new()))
3883+
};
3884+
38783885
let output_detail = CoreSurfaceOutputDetail {
38793886
context: self.context.clone(),
38803887
surface_id: self.id,
3888+
error_sink: error_sink.clone(),
38813889
}
38823890
.into();
38833891

@@ -3890,7 +3898,7 @@ impl dispatch::SurfaceInterface for CoreSurface {
38903898
.map(|id| CoreTexture {
38913899
context: self.context.clone(),
38923900
id,
3893-
error_sink: Arc::new(Mutex::new(ErrorSinkRaw::new())),
3901+
error_sink,
38943902
})
38953903
.map(Into::into);
38963904

@@ -3926,7 +3934,10 @@ impl dispatch::SurfaceOutputDetailInterface for CoreSurfaceOutputDetail {
39263934
fn present(&self) {
39273935
match self.context.0.surface_present(self.surface_id) {
39283936
Ok(_status) => (),
3929-
Err(err) => self.context.handle_error_fatal(err, "Surface::present"),
3937+
Err(err) => {
3938+
self.context
3939+
.handle_error_nolabel(&self.error_sink, err, "Surface::present");
3940+
}
39303941
}
39313942
}
39323943

0 commit comments

Comments
 (0)