extensions/google: Add VK_GOOGLE_display_timing (#765)
This commit is contained in:
parent
a0f8b9cf3e
commit
369fe05e79
|
@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Allow building `Entry`/`Instance`/`Device` from handle+fns (see their `from_parts_1_x()` associated functions) (#748)
|
- Allow building `Entry`/`Instance`/`Device` from handle+fns (see their `from_parts_1_x()` associated functions) (#748)
|
||||||
- Update Vulkan-Headers to 1.3.254 (#760)
|
- Update Vulkan-Headers to 1.3.254 (#760)
|
||||||
- Added `VK_NV_memory_decompression` device extension (#761)
|
- Added `VK_NV_memory_decompression` device extension (#761)
|
||||||
|
- Added `VK_GOOGLE_display_timing` device extension (#765)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
56
ash/src/extensions/google/display_timing.rs
Normal file
56
ash/src/extensions/google/display_timing.rs
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
use crate::prelude::*;
|
||||||
|
use crate::vk;
|
||||||
|
use crate::{Device, Instance};
|
||||||
|
use std::ffi::CStr;
|
||||||
|
use std::mem;
|
||||||
|
|
||||||
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_GOOGLE_display_timing.html>
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct DisplayTiming {
|
||||||
|
handle: vk::Device,
|
||||||
|
fp: vk::GoogleDisplayTimingFn,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DisplayTiming {
|
||||||
|
pub fn new(instance: &Instance, device: &Device) -> Self {
|
||||||
|
let handle = device.handle();
|
||||||
|
let fp = vk::GoogleDisplayTimingFn::load(|name| unsafe {
|
||||||
|
mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr()))
|
||||||
|
});
|
||||||
|
Self { handle, fp }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPastPresentationTimingGOOGLE.html>
|
||||||
|
#[inline]
|
||||||
|
pub unsafe fn get_past_presentation_timing(
|
||||||
|
&self,
|
||||||
|
swapchain: vk::SwapchainKHR,
|
||||||
|
) -> VkResult<Vec<vk::PastPresentationTimingGOOGLE>> {
|
||||||
|
read_into_uninitialized_vector(|count, data| {
|
||||||
|
(self.fp.get_past_presentation_timing_google)(self.handle, swapchain, count, data)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetRefreshCycleDurationGOOGLE.html>
|
||||||
|
#[inline]
|
||||||
|
pub unsafe fn get_refresh_cycle_duration(
|
||||||
|
&self,
|
||||||
|
swapchain: vk::SwapchainKHR,
|
||||||
|
) -> VkResult<vk::RefreshCycleDurationGOOGLE> {
|
||||||
|
let mut properties = mem::zeroed();
|
||||||
|
(self.fp.get_refresh_cycle_duration_google)(self.handle, swapchain, &mut properties)
|
||||||
|
.result_with_success(properties)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const NAME: &'static CStr = vk::GoogleDisplayTimingFn::NAME;
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn fp(&self) -> &vk::GoogleDisplayTimingFn {
|
||||||
|
&self.fp
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn device(&self) -> vk::Device {
|
||||||
|
self.handle
|
||||||
|
}
|
||||||
|
}
|
3
ash/src/extensions/google/mod.rs
Normal file
3
ash/src/extensions/google/mod.rs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
pub use self::display_timing::DisplayTiming;
|
||||||
|
|
||||||
|
mod display_timing;
|
|
@ -1,4 +1,5 @@
|
||||||
pub mod ext;
|
pub mod ext;
|
||||||
|
pub mod google;
|
||||||
pub mod khr;
|
pub mod khr;
|
||||||
pub mod mvk;
|
pub mod mvk;
|
||||||
pub mod nn;
|
pub mod nn;
|
||||||
|
|
Loading…
Reference in a new issue