From 86cf6ecbc2f59f582317830dd1e1a21e97e78422 Mon Sep 17 00:00:00 2001 From: crowlkats Date: Mon, 9 Jan 2023 17:57:51 +0100 Subject: [PATCH 1/2] fix(core): don't panic on mapped buffer in queue_submit --- wgpu-core/src/device/queue.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wgpu-core/src/device/queue.rs b/wgpu-core/src/device/queue.rs index ba0fb053da..990043f245 100644 --- a/wgpu-core/src/device/queue.rs +++ b/wgpu-core/src/device/queue.rs @@ -307,6 +307,8 @@ pub enum QueueSubmitError { DestroyedTexture(id::TextureId), #[error(transparent)] Unmap(#[from] BufferAccessError), + #[error("Buffer {0:?} is still mapped")] + BufferStillMapped(id::BufferId), #[error("surface output was dropped before the command buffer got submitted")] SurfaceOutputDropped, #[error("surface was unconfigured before the command buffer got submitted")] @@ -904,7 +906,7 @@ impl Global { } else { match buffer.map_state { BufferMapState::Idle => (), - _ => panic!("Buffer {:?} is still mapped", id), + _ => return Err(QueueSubmitError::BufferStillMapped(id.0)), } } } From 0fbf6a724144a42d63f4415d5a6fbbd6a2716416 Mon Sep 17 00:00:00 2001 From: crowlkats Date: Sun, 15 Jan 2023 06:48:50 +0100 Subject: [PATCH 2/2] CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d222b4d984..eecfb6e462 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -174,6 +174,7 @@ Additionally `Surface::get_default_config` now returns an Option and returns Non - Evaluate `gfx_select!`'s `#[cfg]` conditions at the right time. By @jimblandy in [#3253](https://github.com/gfx-rs/wgpu/pull/3253) - Improve error messages when binding bind group with dynamic offsets. By @cwfitzgerald in [#3294](https://github.com/gfx-rs/wgpu/pull/3294) - Allow non-filtering sampling of integer textures. By @JMS55 in [#3362](https://github.com/gfx-rs/wgpu/pull/3362). +- Don't panic on mapped buffer in queue_submit. By @crowlKats in [#3364](https://github.com/gfx-rs/wgpu/pull/3364). #### Metal - Fix texture view creation with full-resource views when using an explicit `mip_level_count` or `array_layer_count`. By @cwfitzgerald in [#3323](https://github.com/gfx-rs/wgpu/pull/3323)