diff --git a/CHANGELOG.md b/CHANGELOG.md index d80f33e2b1..51b5182c8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -93,6 +93,7 @@ the same every time it is rendered, we now warn if it is missing. #### Vulkan - Remove use of Vulkan12Features/Properties types. By @i509VCB in [#2936](https://github.com/gfx-rs/wgpu/pull/2936) +- Provide a means for `wgpu` users to access `vk::Queue` and the queue index. By @anlumo in [#2950](https://github.com/gfx-rs/wgpu/pull/2950) ### Documentation diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index 0b5fe309c5..0a3afb690e 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -1181,6 +1181,8 @@ impl super::Adapter { let shared = Arc::new(super::DeviceShared { raw: raw_device, family_index, + queue_index, + raw_queue, 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 388fb86aed..b9d74e36e3 100644 --- a/wgpu-hal/src/vulkan/device.rs +++ b/wgpu-hal/src/vulkan/device.rs @@ -714,6 +714,10 @@ impl super::Device { self.shared.family_index } + pub fn queue_index(&self) -> u32 { + self.shared.queue_index + } + pub fn raw_device(&self) -> &ash::Device { &self.shared.raw } @@ -722,6 +726,10 @@ impl super::Device { self.shared.physical_device } + pub fn raw_queue(&self) -> ash::vk::Queue { + self.shared.raw_queue + } + 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 2f8c5e97d6..d3416a50ed 100644 --- a/wgpu-hal/src/vulkan/mod.rs +++ b/wgpu-hal/src/vulkan/mod.rs @@ -296,6 +296,8 @@ impl UpdateAfterBindTypes { struct DeviceShared { raw: ash::Device, family_index: u32, + queue_index: u32, + raw_queue: ash::vk::Queue, handle_is_owned: bool, instance: Arc, physical_device: ash::vk::PhysicalDevice,