diff --git a/Changelog.md b/Changelog.md index efb0e54bb..55059a908 100644 --- a/Changelog.md +++ b/Changelog.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added `VK_KHR_cooperative_matrix` instance extension (#782) - Added `VK_EXT_vertex_input_dynamic_state` device extension (#784) - Added `VK_KHR_sampler_ycbcr_conversion` device extension (#785) +- Added `VK_EXT_swapchain_maintenance1` device extension (#786) ### Changed diff --git a/ash/src/extensions/ext/mod.rs b/ash/src/extensions/ext/mod.rs index 17b978919..680a99761 100644 --- a/ash/src/extensions/ext/mod.rs +++ b/ash/src/extensions/ext/mod.rs @@ -21,6 +21,7 @@ pub use self::pipeline_properties::PipelineProperties; pub use self::private_data::PrivateData; pub use self::sample_locations::SampleLocations; pub use self::shader_object::ShaderObject; +pub use self::swapchain_maintenance1::SwapchainMaintenance1; pub use self::tooling_info::ToolingInfo; pub use self::vertex_input_dynamic_state::VertexInputDynamicState; @@ -47,5 +48,6 @@ mod pipeline_properties; mod private_data; mod sample_locations; mod shader_object; +mod swapchain_maintenance1; mod tooling_info; mod vertex_input_dynamic_state; diff --git a/ash/src/extensions/ext/swapchain_maintenance1.rs b/ash/src/extensions/ext/swapchain_maintenance1.rs new file mode 100644 index 000000000..cf61ecbf0 --- /dev/null +++ b/ash/src/extensions/ext/swapchain_maintenance1.rs @@ -0,0 +1,43 @@ +use crate::prelude::*; +use crate::vk; +use crate::{Device, Instance}; +use std::ffi::CStr; +use std::mem; + +/// +#[derive(Clone)] +pub struct SwapchainMaintenance1 { + handle: vk::Device, + fp: vk::ExtSwapchainMaintenance1Fn, +} + +impl SwapchainMaintenance1 { + pub fn new(instance: &Instance, device: &Device) -> Self { + let handle = device.handle(); + let fp = vk::ExtSwapchainMaintenance1Fn::load(|name| unsafe { + mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr())) + }); + Self { handle, fp } + } + + /// + #[inline] + pub unsafe fn release_swapchain_images( + &self, + release_info: &vk::ReleaseSwapchainImagesInfoEXT<'_>, + ) -> VkResult<()> { + (self.fp.release_swapchain_images_ext)(self.handle, release_info).result() + } + + pub const NAME: &'static CStr = vk::ExtSwapchainMaintenance1Fn::NAME; + + #[inline] + pub fn fp(&self) -> &vk::ExtSwapchainMaintenance1Fn { + &self.fp + } + + #[inline] + pub fn device(&self) -> vk::Device { + self.handle + } +}