From 68b8be5de7bc4ce520deb7508883863c9da5c921 Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Tue, 11 Oct 2022 16:44:36 +0200 Subject: [PATCH] Make some errors non-fatal. --- wgpu-core/src/hub.rs | 3 +-- wgpu/src/backend/direct.rs | 9 +++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/wgpu-core/src/hub.rs b/wgpu-core/src/hub.rs index 8e256e7c328..2c586c930e1 100644 --- a/wgpu-core/src/hub.rs +++ b/wgpu-core/src/hub.rs @@ -358,9 +358,8 @@ impl Storage { let (index, epoch, _) = id.unzip(); let (result, storage_epoch) = match self.map.get_mut(index as usize) { Some(&mut Element::Occupied(ref mut v, epoch)) => (Ok(v), epoch), - Some(&mut Element::Vacant) => panic!("{}[{}] does not exist", self.kind, index), + Some(&mut Element::Vacant) | None => panic!("{}[{}] does not exist", self.kind, index), Some(&mut Element::Error(epoch, ..)) => (Err(InvalidId), epoch), - None => return Err(InvalidId), }; assert_eq!( epoch, storage_epoch, diff --git a/wgpu/src/backend/direct.rs b/wgpu/src/backend/direct.rs index 93b313205dd..49d0678d179 100644 --- a/wgpu/src/backend/direct.rs +++ b/wgpu/src/backend/direct.rs @@ -1793,7 +1793,7 @@ impl crate::Context for Context { let global = &self.0; match wgc::gfx_select!(buffer.id => global.buffer_destroy(buffer.id)) { Ok(()) => (), - Err(err) => self.handle_error_fatal(err, "Buffer::destroy"), + Err(err) => self.handle_error_nolabel(&buffer.error_sink, err, "Buffer::destroy"), } } fn buffer_drop(&self, buffer: &Self::BufferId) { @@ -1804,7 +1804,7 @@ impl crate::Context for Context { let global = &self.0; match wgc::gfx_select!(texture.id => global.texture_destroy(texture.id)) { Ok(()) => (), - Err(err) => self.handle_error_fatal(err, "Texture::destroy"), + Err(err) => self.handle_error_nolabel(&texture.error_sink, err, "Texture::destroy"), } } fn texture_drop(&self, texture: &Self::TextureId) { @@ -1813,10 +1813,7 @@ impl crate::Context for Context { } fn texture_view_drop(&self, texture_view: &Self::TextureViewId) { let global = &self.0; - match wgc::gfx_select!(*texture_view => global.texture_view_drop(*texture_view, false)) { - Ok(()) => (), - Err(err) => self.handle_error_fatal(err, "TextureView::drop"), - } + let _ = wgc::gfx_select!(*texture_view => global.texture_view_drop(*texture_view, false)); } fn sampler_drop(&self, sampler: &Self::SamplerId) { let global = &self.0;