From ecaacfa20e0a4f4de6802303ec6b529d822a30bd Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Tue, 5 Mar 2019 14:12:14 -0500 Subject: [PATCH] Force wait for GPU before releasing the old swapchain --- wgpu-native/src/device.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wgpu-native/src/device.rs b/wgpu-native/src/device.rs index 49659e5c0..64273143e 100644 --- a/wgpu-native/src/device.rs +++ b/wgpu-native/src/device.rs @@ -1515,14 +1515,17 @@ pub fn device_create_swap_chain( config.format, formats); } //TODO: properly exclusive range + /* TODO: this is way too restrictive assert!(desc.width >= caps.extents.start.width && desc.width <= caps.extents.end.width && desc.height >= caps.extents.start.height && desc.height <= caps.extents.end.height, "Requested size {}x{} is outside of the supported range: {:?}", desc.width, desc.height, caps.extents); - + */ let (old_raw, sem_available, command_pool) = match surface.swap_chain.take() { Some(mut old) => { + //TODO: remove this once gfx-rs stops destroying the old swapchain + device.raw.wait_idle().unwrap(); let mut destroyed = device.destroyed.lock(); assert_eq!(old.device_id.value, device_id); for frame in old.frames {