From 46176d45b1ed218e9c0d753dbf4c2ee708099edd Mon Sep 17 00:00:00 2001 From: Hashim Date: Fri, 6 Nov 2026 07:54:47 -0800 Subject: [PATCH] Only wait for the Vulkan acquire fence for FIFO on Windows (#10714) Co-authored-by: Connor Fitzgerald --- CHANGELOG.md | 1 + wgpu-hal/src/vulkan/swapchain/native.rs | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61e70a00c..278f49482 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -292,6 +292,7 @@ By @sagudev in [#10307](https://github.com/gfx-rs/wgpu/pull/10307). #### Vulkan +- On Windows, only wait for the swapchain acquire fence in `Fifo` and `FifoRelaxed` present modes. It added acquire latency in `Immediate` and `Mailbox`. By @HashimTheArab in [#10714](https://github.com/gfx-rs/wgpu/pull/10714). - Fix `HalCounters::textures` drifting negative: `create_texture` never incremented it while `destroy_texture` always decremented it. By @dustyleary in [#10022](https://github.com/gfx-rs/wgpu/pull/10022). - Fix `VUID-VkImageViewCreateInfo-image-04441` validation errors when creating a view of a texture whose only usages are `COPY_SRC` and/or `COPY_DST`. By @MannXo in [#10200](https://github.com/gfx-rs/wgpu/issues/10200). - Add OpenHarmony surface support via `VK_OHOS_surface`. Previously the Vulkan backend could not create a surface on OpenHarmony, leaving GLES as the only usable backend. By @ozongzi in [#9908](https://github.com/gfx-rs/wgpu/pull/9908). diff --git a/wgpu-hal/src/vulkan/swapchain/native.rs b/wgpu-hal/src/vulkan/swapchain/native.rs index 29d536dc6..d739435ed 100644 --- a/wgpu-hal/src/vulkan/swapchain/native.rs +++ b/wgpu-hal/src/vulkan/swapchain/native.rs @@ -278,11 +278,16 @@ impl Surface for NativeSurface { let images = unsafe { functor.get_swapchain_images(raw) } .map_err(crate::vulkan::map_host_device_oom_err)?; - // This fence is only used to throttle acquisition on Windows. It is very important to + // This fence is only used to throttle FIFO acquisition on Windows. It is very important to // avoid bad frame pacing when the Vulkan driver is using a DXGI swapchain. See // https://github.com/gfx-rs/wgpu/issues/8310 and - // https://github.com/gfx-rs/wgpu/issues/8354 for more details. - let fence = if cfg!(target_os = "windows") { + // https://github.com/gfx-rs/wgpu/issues/8354 for more details. In other present modes it + // only adds acquire latency, see https://github.com/gfx-rs/wgpu/issues/9559. + let fence = if cfg!(target_os = "windows") + && matches!( + config.present_mode, + wgt::PresentMode::Fifo | wgt::PresentMode::FifoRelaxed + ) { let raw = unsafe { device .shared