Skip to content

Commit

Permalink
allow access to queue family index in vulkan hal device (#2859)
Browse files Browse the repository at this point in the history
  • Loading branch information
i509VCB authored and cwfitzgerald committed Jul 14, 2022
1 parent 6653dd5 commit a739354
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ Bottom level categories:
- Fix depth stencil texture format capability by @jinleili in [#2854](https://github.com/gfx-rs/wgpu/pull/2854)
- `get_texture_format_features` now only returns usages for formats it actually supports by @cwfitzgerald in [#2856](https://github.com/gfx-rs/wgpu/pull/2856)

#### Hal

- Allow access to queue family index in Vulkan hal by @i509VCB in [#2859](https://github.com/gfx-rs/wgpu/pull/2859)

### Documentation
- Update present_mode docs as most of them don't automatically fall back to Fifo anymore. by @Elabajaba in [#2855](https://github.com/gfx-rs/wgpu/pull/2855)

Expand Down
1 change: 1 addition & 0 deletions wgpu-hal/src/vulkan/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,7 @@ impl super::Adapter {

let shared = Arc::new(super::DeviceShared {
raw: raw_device,
family_index,
handle_is_owned,
instance: Arc::clone(&self.instance),
physical_device: self.raw,
Expand Down
9 changes: 9 additions & 0 deletions wgpu-hal/src/vulkan/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,15 @@ impl super::Device {
})
}

/// Returns the queue family index of the device's internal queue.
///
/// This is useful for constructing memory barriers needed for queue family ownership transfer when
/// external memory is involved (from/to `VK_QUEUE_FAMILY_EXTERNAL_KHR` and `VK_QUEUE_FAMILY_FOREIGN_EXT`
/// for example).
pub fn queue_family_index(&self) -> u32 {
self.shared.family_index
}

pub fn raw_device(&self) -> &ash::Device {
&self.shared.raw
}
Expand Down
1 change: 1 addition & 0 deletions wgpu-hal/src/vulkan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ impl UpdateAfterBindTypes {

struct DeviceShared {
raw: ash::Device,
family_index: u32,
handle_is_owned: bool,
instance: Arc<InstanceShared>,
physical_device: ash::vk::PhysicalDevice,
Expand Down

0 comments on commit a739354

Please sign in to comment.