Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `VK_EXT_metal_objects` device extension (#942)
- Added `VK_AMD_anti_lag` device extension (#943)
- Added `VK_KHR_video_queue`, `VK_KHR_video_encode_queue`, and `VK_KHR_video_decode_queue` device extensions (#965)
- Added `VK_NV_cooperative_vector` device extension (#1007)

### Changed

Expand Down
70 changes: 70 additions & 0 deletions ash/src/extensions/nv/cooperative_vector.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_NV_cooperative_vector.html>

use crate::vk;
use crate::VkResult;
use core::mem;
use core::ptr;

impl crate::nv::cooperative_vector::Instance {
/// Retrieve the number of elements to pass to [`get_physical_device_cooperative_vector_properties()`][Self::get_physical_device_cooperative_vector_properties()]
#[inline]
pub unsafe fn get_physical_device_cooperative_vector_properties_len(
&self,
physical_device: vk::PhysicalDevice,
) -> VkResult<usize> {
let mut count = mem::MaybeUninit::uninit();
(self.fp.get_physical_device_cooperative_vector_properties_nv)(
physical_device,
count.as_mut_ptr(),
ptr::null_mut(),
)
.assume_init_on_success(count)
.map(|c| c as usize)
}

/// <https://registry.khronos.org/vulkan/specs/latest/man/html/vkGetPhysicalDeviceCooperativeVectorPropertiesNV.html>
///
/// Call [`get_physical_device_cooperative_vector_properties_len()`][Self::get_physical_device_cooperative_vector_properties_len()] to query the number of elements to pass to `out`.
/// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
#[inline]
pub unsafe fn get_physical_device_cooperative_vector_properties(
&self,
physical_device: vk::PhysicalDevice,
out: &mut [vk::CooperativeVectorPropertiesNV<'_>],
) -> VkResult<()> {
let mut count = out.len() as u32;
(self.fp.get_physical_device_cooperative_vector_properties_nv)(
physical_device,
&mut count,
out.as_mut_ptr(),
)
.result()?;
assert_eq!(count as usize, out.len());
Ok(())
}
}

impl crate::nv::cooperative_vector::Device {
/// <https://registry.khronos.org/vulkan/specs/latest/man/html/vkCmdConvertCooperativeVectorMatrixNV.html>
#[inline]
pub unsafe fn cmd_convert_cooperative_vector_matrix(
&self,
command_buffer: vk::CommandBuffer,
infos: &[vk::ConvertCooperativeVectorMatrixInfoNV<'_>],
) {
(self.fp.cmd_convert_cooperative_vector_matrix_nv)(
command_buffer,
infos.len() as u32,
infos.as_ptr(),
)
}

/// <https://registry.khronos.org/vulkan/specs/latest/man/html/vkConvertCooperativeVectorMatrixNV.html>
#[inline]
pub unsafe fn convert_cooperative_vector_matrix(
&self,
info: &vk::ConvertCooperativeVectorMatrixInfoNV<'_>,
) -> VkResult<()> {
(self.fp.convert_cooperative_vector_matrix_nv)(self.handle, info).result()
}
}
1 change: 1 addition & 0 deletions ash/src/extensions/nv/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod cooperative_vector;
pub mod copy_memory_indirect;
pub mod coverage_reduction_mode;
pub mod cuda_kernel_launch;
Expand Down
Loading