From 0652aee6959e2cec22da525bc0d6a0a5aa894cac Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Tue, 15 Aug 2023 21:43:01 +0200 Subject: [PATCH] extensions/ext: Add VK_EXT_swapchain_maintenance1 (#786) --- Changelog.md | 1 + ash/src/extensions/ext/mod.rs | 2 + .../extensions/ext/swapchain_maintenance1.rs | 43 +++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 ash/src/extensions/ext/swapchain_maintenance1.rs diff --git a/Changelog.md b/Changelog.md index efb0e54..55059a9 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 17b9789..680a997 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 0000000..cf61ecb --- /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 + } +}