extensions/ext: Add VK_EXT_swapchain_maintenance1 (#786)

This commit is contained in:
Marijn Suijten 2023-08-15 21:43:01 +02:00 committed by GitHub
parent 5a9d779eef
commit 0652aee695
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 0 deletions

View file

@ -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

View file

@ -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;

View file

@ -0,0 +1,43 @@
use crate::prelude::*;
use crate::vk;
use crate::{Device, Instance};
use std::ffi::CStr;
use std::mem;
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_swapchain_maintenance1.html>
#[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 }
}
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkReleaseSwapchainImagesEXT.html>
#[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
}
}