From ecca99eb0029c7d906c7e05d4dc56ec0e7e6ce86 Mon Sep 17 00:00:00 2001 From: Andreas Monitzer Date: Sun, 14 Aug 2022 22:34:02 +0200 Subject: [PATCH] Persist device queue directly in the Vulkan hal, also added accessor to the queue index there. --- wgpu-hal/src/vulkan/adapter.rs | 1 + wgpu-hal/src/vulkan/device.rs | 10 +++++----- wgpu-hal/src/vulkan/mod.rs | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index b19fb347eec..f78352d9524 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -1309,6 +1309,7 @@ impl super::Adapter { 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 ecb526136fd..db30220c321 100644 --- a/wgpu-hal/src/vulkan/device.rs +++ b/wgpu-hal/src/vulkan/device.rs @@ -711,6 +711,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 } @@ -720,11 +724,7 @@ impl super::Device { } pub fn raw_queue(&self) -> ash::vk::Queue { - unsafe { - self.shared - .raw - .get_device_queue(self.queue_family_index(), self.shared.queue_index) - } + self.shared.raw_queue } pub fn enabled_device_extensions(&self) -> &[&'static CStr] { diff --git a/wgpu-hal/src/vulkan/mod.rs b/wgpu-hal/src/vulkan/mod.rs index 24d4d8cb7eb..cc9e08be185 100644 --- a/wgpu-hal/src/vulkan/mod.rs +++ b/wgpu-hal/src/vulkan/mod.rs @@ -314,6 +314,7 @@ 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,