From a13f0a03ef568d0a641edf5300c63c23ee569ee2 Mon Sep 17 00:00:00 2001 From: Vecvec <130132884+Vecvec@users.noreply.github.com> Date: Thu, 13 Mar 2025 04:27:34 +1300 Subject: [PATCH] [vulkan] Automatically add linux buffer sharing extensions if available. (#7317) * Automatically add linux sharing extensions to the requirements if supported. * Correct comment. --- wgpu-hal/src/vulkan/adapter.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index 6d0a039d72..8d315f042b 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -1051,6 +1051,16 @@ impl PhysicalDeviceProperties { extensions.push(khr::external_memory_win32::NAME); } + // Optional `VK_KHR_external_memory_fd` + if self.supports_extension(khr::external_memory_fd::NAME) { + extensions.push(khr::external_memory_fd::NAME); + } + + // Optional `VK_EXT_external_memory_dma` + if self.supports_extension(ext::external_memory_dma_buf::NAME) { + extensions.push(ext::external_memory_dma_buf::NAME); + } + // Require `VK_KHR_draw_indirect_count` if the associated feature was requested // Even though Vulkan 1.2 has promoted the extension to core, we must require the extension to avoid // large amounts of spaghetti involved with using PhysicalDeviceVulkan12Features.