Skip to content

Commit c6c7143

Browse files
committed
Make some surface operation errors non-fatal.
1 parent 8ff1eb9 commit c6c7143

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
@@ -617,6 +617,7 @@ pub struct CoreTlas {
617617
pub struct CoreSurfaceOutputDetail {
618618
context: ContextWgpuCore,
619619
surface_id: wgc::id::SurfaceId,
620+
error_sink: ErrorSink,
620621
}
621622

622623
type ErrorSink = Arc<Mutex<ErrorSinkRaw>>;
@@ -3822,9 +3823,16 @@ impl dispatch::SurfaceInterface for CoreSurface {
38223823
crate::SurfaceStatus,
38233824
dispatch::DispatchSurfaceOutputDetail,
38243825
) {
3826+
let error_sink = if let Some(error_sink) = self.error_sink.lock().as_ref() {
3827+
error_sink.clone()
3828+
} else {
3829+
Arc::new(Mutex::new(ErrorSinkRaw::new()))
3830+
};
3831+
38253832
let output_detail = CoreSurfaceOutputDetail {
38263833
context: self.context.clone(),
38273834
surface_id: self.id,
3835+
error_sink: error_sink.clone(),
38283836
}
38293837
.into();
38303838

@@ -3837,7 +3845,7 @@ impl dispatch::SurfaceInterface for CoreSurface {
38373845
.map(|id| CoreTexture {
38383846
context: self.context.clone(),
38393847
id,
3840-
error_sink: Arc::new(Mutex::new(ErrorSinkRaw::new())),
3848+
error_sink,
38413849
})
38423850
.map(Into::into);
38433851

@@ -3873,7 +3881,10 @@ impl dispatch::SurfaceOutputDetailInterface for CoreSurfaceOutputDetail {
38733881
fn present(&self) {
38743882
match self.context.0.surface_present(self.surface_id) {
38753883
Ok(_status) => (),
3876-
Err(err) => self.context.handle_error_fatal(err, "Surface::present"),
3884+
Err(err) => {
3885+
self.context
3886+
.handle_error_nolabel(&self.error_sink, err, "Surface::present");
3887+
}
38773888
}
38783889
}
38793890

0 commit comments

Comments
 (0)