|
| 1 | +//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_NV_cooperative_vector.html> |
| 2 | +
|
| 3 | +use crate::prelude::*; |
| 4 | +use crate::vk; |
| 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 | +} |
0 commit comments