Skip to content

Commit

Permalink
Make some errors non-fatal.
Browse files Browse the repository at this point in the history
  • Loading branch information
nical committed Oct 11, 2022
1 parent 02b0488 commit 68b8be5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
3 changes: 1 addition & 2 deletions wgpu-core/src/hub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,8 @@ impl<T, I: id::TypedId> Storage<T, I> {
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,
Expand Down
9 changes: 3 additions & 6 deletions wgpu/src/backend/direct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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;
Expand Down

0 comments on commit 68b8be5

Please sign in to comment.