From 2c153f5d504ce063a71745128af36db7c18ecd43 Mon Sep 17 00:00:00 2001 From: Imbris Date: Sun, 28 Feb 2021 00:56:17 -0500 Subject: [PATCH] Fix issue with multiple queued mappings where the last one is not cancelled --- wgpu-core/src/device/life.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wgpu-core/src/device/life.rs b/wgpu-core/src/device/life.rs index c4694b2c3b..c903781e13 100644 --- a/wgpu-core/src/device/life.rs +++ b/wgpu-core/src/device/life.rs @@ -700,6 +700,12 @@ impl LifetimeTracker { resource::BufferMapState::Waiting(pending_mapping) => pending_mapping, // Mapping cancelled resource::BufferMapState::Idle => continue, + // Mapping queued at least twice by map -> unmap -> map + // and was already successfully mapped below + active @ resource::BufferMapState::Active { .. } => { + buffer.map_state = active; + continue; + } _ => panic!("No pending mapping."), }; let status = if mapping.range.start != mapping.range.end {