Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extensions/ext: Add VK_EXT_swapchain_maintenance1 #786

Merged
merged 1 commit into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions ash/src/extensions/ext/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
43 changes: 43 additions & 0 deletions ash/src/extensions/ext/swapchain_maintenance1.rs
Original file line number Diff line number Diff line change
@@ -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
}
}