Debian Codegraph @

src/extensions/ext/calibrated_timestamps.rs

raw symbols SCIP
1 //! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_calibrated_timestamps.html>
2
3 use crate::prelude::*;
4 use crate::vk;
5 use alloc::vec::Vec;
6 use core::mem;
7
8 impl crate::ext::calibrated_timestamps::Device {
9 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetCalibratedTimestampsEXT.html>
10 ///
11 /// Returns a tuple containing `(timestamps, max_deviation)`
12 #[inline]
13 pub unsafe fn get_calibrated_timestamps(
14 &self,
15 info: &[vk::CalibratedTimestampInfoEXT<'_>],
16 ) -> VkResult<(Vec<u64>, u64)> {
17 let mut timestamps = Vec::with_capacity(info.len());
18 let mut max_deviation = mem::MaybeUninit::uninit();
19 let max_deviation = (self.fp.get_calibrated_timestamps_ext)(
20 self.handle,
21 info.len() as u32,
22 info.as_ptr(),
23 timestamps.as_mut_ptr(),
24 max_deviation.as_mut_ptr(),
25 )
26 .assume_init_on_success(max_deviation)?;
27 timestamps.set_len(info.len());
28 Ok((timestamps, max_deviation))
29 }
30 }
31
32 impl crate::ext::calibrated_timestamps::Instance {
33 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceCalibrateableTimeDomainsEXT.html>
34 #[inline]
35 pub unsafe fn get_physical_device_calibrateable_time_domains(
36 &self,
37 physical_device: vk::PhysicalDevice,
38 ) -> VkResult<Vec<vk::TimeDomainEXT>> {
39 read_into_uninitialized_vector(|count, data| {
40 (self.fp.get_physical_device_calibrateable_time_domains_ext)(
41 physical_device,
42 count,
43 data,
44 )
45 })
46 }
47 }