From c8f669cf109a846236ed057b463c53e0259f17f8 Mon Sep 17 00:00:00 2001 From: Azorlogh Date: Thu, 28 Sep 2023 19:13:58 +0200 Subject: [PATCH 1/2] Fix x11 hang when resizing on vulkan --- wgpu-hal/src/vulkan/instance.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wgpu-hal/src/vulkan/instance.rs b/wgpu-hal/src/vulkan/instance.rs index 18269fff77..ae3827e8cf 100644 --- a/wgpu-hal/src/vulkan/instance.rs +++ b/wgpu-hal/src/vulkan/instance.rs @@ -157,6 +157,10 @@ impl super::Swapchain { /// - The device must have been made idle before calling this function. unsafe fn release_resources(self, device: &ash::Device) -> Self { profiling::scope!("Swapchain::release_resources"); + { + profiling::scope!("vkDeviceWaitIdle"); + let _ = unsafe { device.device_wait_idle() }; + }; unsafe { device.destroy_fence(self.fence, None) }; self } From 521f3e6cda800480df73f85141dcdcf571c429be Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Tue, 3 Oct 2023 16:13:55 -0400 Subject: [PATCH 2/2] Update wgpu-hal/src/vulkan/instance.rs --- wgpu-hal/src/vulkan/instance.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wgpu-hal/src/vulkan/instance.rs b/wgpu-hal/src/vulkan/instance.rs index ae3827e8cf..2dda7a2c3a 100644 --- a/wgpu-hal/src/vulkan/instance.rs +++ b/wgpu-hal/src/vulkan/instance.rs @@ -159,6 +159,8 @@ impl super::Swapchain { profiling::scope!("Swapchain::release_resources"); { profiling::scope!("vkDeviceWaitIdle"); + // We need to also wait until all presentation work is done. Because there is no way to portably wait until + // the presentation work is done, we are forced to wait until the device is idle. let _ = unsafe { device.device_wait_idle() }; }; unsafe { device.destroy_fence(self.fence, None) };