Skip to content

Commit 5ca5860

Browse files
committed
extensions/nv: Add VK_NV_cooperative_vector
1 parent e377fb5 commit 5ca5860

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
- Added `VK_EXT_metal_objects` device extension (#942)
1616
- Added `VK_AMD_anti_lag` device extension (#943)
1717
- Added `VK_KHR_video_queue`, `VK_KHR_video_encode_queue`, and `VK_KHR_video_decode_queue` device extensions (#965)
18+
- Added `VK_NV_cooperative_vector` device extension (#1007)
1819

1920
### Changed
2021

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_NV_cooperative_vector.html>
2+
3+
use crate::vk;
4+
use crate::VkResult;
5+
use core::mem;
6+
use core::ptr;
7+
8+
impl crate::nv::cooperative_vector::Instance {
9+
/// Retrieve the number of elements to pass to [`get_physical_device_cooperative_vector_properties()`][Self::get_physical_device_cooperative_vector_properties()]
10+
#[inline]
11+
pub unsafe fn get_physical_device_cooperative_vector_properties_len(
12+
&self,
13+
physical_device: vk::PhysicalDevice,
14+
) -> VkResult<usize> {
15+
let mut count = mem::MaybeUninit::uninit();
16+
(self.fp.get_physical_device_cooperative_vector_properties_nv)(
17+
physical_device,
18+
count.as_mut_ptr(),
19+
ptr::null_mut(),
20+
)
21+
.assume_init_on_success(count)
22+
.map(|c| c as usize)
23+
}
24+
25+
/// <https://registry.khronos.org/vulkan/specs/latest/man/html/vkGetPhysicalDeviceCooperativeVectorPropertiesNV.html>
26+
///
27+
/// 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`.
28+
/// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
29+
#[inline]
30+
pub unsafe fn get_physical_device_cooperative_vector_properties(
31+
&self,
32+
physical_device: vk::PhysicalDevice,
33+
out: &mut [vk::CooperativeVectorPropertiesNV<'_>],
34+
) -> VkResult<()> {
35+
let mut count = out.len() as u32;
36+
(self.fp.get_physical_device_cooperative_vector_properties_nv)(
37+
physical_device,
38+
&mut count,
39+
out.as_mut_ptr(),
40+
)
41+
.result()?;
42+
assert_eq!(count as usize, out.len());
43+
Ok(())
44+
}
45+
}
46+
47+
impl crate::nv::cooperative_vector::Device {
48+
/// <https://registry.khronos.org/vulkan/specs/latest/man/html/vkCmdConvertCooperativeVectorMatrixNV.html>
49+
#[inline]
50+
pub unsafe fn cmd_convert_cooperative_vector_matrix(
51+
&self,
52+
command_buffer: vk::CommandBuffer,
53+
infos: &[vk::ConvertCooperativeVectorMatrixInfoNV<'_>],
54+
) {
55+
(self.fp.cmd_convert_cooperative_vector_matrix_nv)(
56+
command_buffer,
57+
infos.len() as u32,
58+
infos.as_ptr(),
59+
)
60+
}
61+
62+
/// <https://registry.khronos.org/vulkan/specs/latest/man/html/vkConvertCooperativeVectorMatrixNV.html>
63+
#[inline]
64+
pub unsafe fn convert_cooperative_vector_matrix(
65+
&self,
66+
info: &vk::ConvertCooperativeVectorMatrixInfoNV<'_>,
67+
) -> VkResult<()> {
68+
(self.fp.convert_cooperative_vector_matrix_nv)(self.handle, info).result()
69+
}
70+
}

ash/src/extensions/nv/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
pub mod cooperative_vector;
12
pub mod copy_memory_indirect;
23
pub mod coverage_reduction_mode;
34
pub mod cuda_kernel_launch;

0 commit comments

Comments
 (0)