Skip to main content

jay_ash/extensions/google/
display_timing.rs

1//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_GOOGLE_display_timing.html>
2
3use crate::prelude::*;
4use crate::vk;
5use alloc::vec::Vec;
6use core::mem;
7
8impl crate::google::display_timing::Device {
9    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPastPresentationTimingGOOGLE.html>
10    #[inline]
11    pub unsafe fn get_past_presentation_timing(
12        &self,
13        swapchain: vk::SwapchainKHR,
14    ) -> VkResult<Vec<vk::PastPresentationTimingGOOGLE>> {
15        unsafe {
16            read_into_uninitialized_vector(|count, data| {
17                (self.fp.get_past_presentation_timing_google)(self.handle, swapchain, count, data)
18            })
19        }
20    }
21
22    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetRefreshCycleDurationGOOGLE.html>
23    #[inline]
24    pub unsafe fn get_refresh_cycle_duration(
25        &self,
26        swapchain: vk::SwapchainKHR,
27    ) -> VkResult<vk::RefreshCycleDurationGOOGLE> {
28        unsafe {
29            let mut properties = mem::MaybeUninit::uninit();
30            (self.fp.get_refresh_cycle_duration_google)(
31                self.handle,
32                swapchain,
33                properties.as_mut_ptr(),
34            )
35            .assume_init_on_success(properties)
36        }
37    }
38}