extensions: Add VK_KHR_present_wait (#493)
This commit is contained in:
parent
2f51478d54
commit
9e14786b83
|
@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased] - ReleaseDate
|
||||
|
||||
### Added
|
||||
|
||||
- Add `VK_KHR_present_wait` extension (#493)
|
||||
|
||||
## [0.33.3] - 2021-09-08
|
||||
|
||||
### Added
|
||||
|
|
|
@ -16,6 +16,7 @@ pub use self::maintenance1::Maintenance1;
|
|||
pub use self::maintenance3::Maintenance3;
|
||||
pub use self::maintenance4::Maintenance4;
|
||||
pub use self::pipeline_executable_properties::PipelineExecutableProperties;
|
||||
pub use self::present_wait::PresentWait;
|
||||
pub use self::push_descriptor::PushDescriptor;
|
||||
pub use self::ray_tracing_pipeline::RayTracingPipeline;
|
||||
pub use self::surface::Surface;
|
||||
|
@ -45,6 +46,7 @@ mod maintenance1;
|
|||
mod maintenance3;
|
||||
mod maintenance4;
|
||||
mod pipeline_executable_properties;
|
||||
mod present_wait;
|
||||
mod push_descriptor;
|
||||
mod ray_tracing_pipeline;
|
||||
mod surface;
|
||||
|
|
45
ash/src/extensions/khr/present_wait.rs
Normal file
45
ash/src/extensions/khr/present_wait.rs
Normal file
|
@ -0,0 +1,45 @@
|
|||
use crate::prelude::*;
|
||||
use crate::vk;
|
||||
use crate::{Device, Instance};
|
||||
use std::ffi::CStr;
|
||||
use std::mem;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct PresentWait {
|
||||
handle: vk::Device,
|
||||
fns: vk::KhrPresentWaitFn,
|
||||
}
|
||||
|
||||
impl PresentWait {
|
||||
pub fn new(instance: &Instance, device: &Device) -> Self {
|
||||
let handle = device.handle();
|
||||
let fns = vk::KhrPresentWaitFn::load(|name| unsafe {
|
||||
mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr()))
|
||||
});
|
||||
Self { handle, fns }
|
||||
}
|
||||
|
||||
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkWaitForPresentKHR.html>"]
|
||||
pub unsafe fn wait_for_present(
|
||||
&self,
|
||||
swapchain: vk::SwapchainKHR,
|
||||
present_id: u64,
|
||||
timeout: u64,
|
||||
) -> VkResult<()> {
|
||||
self.fns
|
||||
.wait_for_present_khr(self.handle, swapchain, present_id, timeout)
|
||||
.result()
|
||||
}
|
||||
|
||||
pub fn name() -> &'static CStr {
|
||||
vk::KhrPresentWaitFn::name()
|
||||
}
|
||||
|
||||
pub fn fp(&self) -> &vk::KhrPresentWaitFn {
|
||||
&self.fns
|
||||
}
|
||||
|
||||
pub fn device(&self) -> vk::Device {
|
||||
self.handle
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue