Skip to content

Commit

Permalink
extensions/ext: Add VK_EXT_swapchain_maintenance1
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 committed Aug 15, 2023
1 parent 5a9d779 commit b7371e4
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
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
}
}

0 comments on commit b7371e4

Please sign in to comment.