From 6706bb8de9ddfa4a7ad34aae7266f2f006c124ec Mon Sep 17 00:00:00 2001 From: Andreas Monitzer Date: Sun, 7 Aug 2022 16:31:09 +0200 Subject: [PATCH] Expose the vk::Queue in the Vulkan hal --- wgpu-hal/src/vulkan/adapter.rs | 1 + wgpu-hal/src/vulkan/device.rs | 8 ++++++++ wgpu-hal/src/vulkan/mod.rs | 1 + 3 files changed, 10 insertions(+) diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index ca086f2f2f8..b19fb347eec 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -1308,6 +1308,7 @@ impl super::Adapter { let shared = Arc::new(super::DeviceShared { raw: raw_device, family_index, + queue_index, handle_is_owned, instance: Arc::clone(&self.instance), physical_device: self.raw, diff --git a/wgpu-hal/src/vulkan/device.rs b/wgpu-hal/src/vulkan/device.rs index cdeea06bccb..ecb526136fd 100644 --- a/wgpu-hal/src/vulkan/device.rs +++ b/wgpu-hal/src/vulkan/device.rs @@ -719,6 +719,14 @@ impl super::Device { self.shared.physical_device } + pub fn raw_queue(&self) -> ash::vk::Queue { + unsafe { + self.shared + .raw + .get_device_queue(self.queue_family_index(), self.shared.queue_index) + } + } + pub fn enabled_device_extensions(&self) -> &[&'static CStr] { &self.shared.enabled_extensions } diff --git a/wgpu-hal/src/vulkan/mod.rs b/wgpu-hal/src/vulkan/mod.rs index 3a7ff095d4b..24d4d8cb7eb 100644 --- a/wgpu-hal/src/vulkan/mod.rs +++ b/wgpu-hal/src/vulkan/mod.rs @@ -313,6 +313,7 @@ impl UpdateAfterBindTypes { struct DeviceShared { raw: ash::Device, family_index: u32, + queue_index: u32, handle_is_owned: bool, instance: Arc, physical_device: ash::vk::PhysicalDevice,