diff --git a/Changelog.md b/Changelog.md index af9b41f9f..e208af985 100644 --- a/Changelog.md +++ b/Changelog.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added `VK_EXT_sample_locations` device extension (#616) - Update Vulkan-Headers to 1.3.211 (#605, #608) - Added `VK_EXT_image_drm_format_modifier` device extension (#603) +- Added new functions to `VK_KHR_swapchain`, available since Vulkan 1.1 (#629) - Added `VK_KHR_device_group_creation` instance extension (#630) ### Removed diff --git a/ash/src/extensions/khr/swapchain.rs b/ash/src/extensions/khr/swapchain.rs index d9b1299f6..d37553889 100755 --- a/ash/src/extensions/khr/swapchain.rs +++ b/ash/src/extensions/khr/swapchain.rs @@ -56,6 +56,7 @@ impl Swapchain { } /// On success, returns the next image's index and whether the swapchain is suboptimal for the surface. + /// /// pub unsafe fn acquire_next_image( &self, @@ -81,6 +82,7 @@ impl Swapchain { } /// On success, returns whether the swapchain is suboptimal for the surface. + /// /// pub unsafe fn queue_present( &self, @@ -95,6 +97,68 @@ impl Swapchain { } } + /// Only available since Vulkan 1.1. + /// + /// + pub unsafe fn get_device_group_present_capabilities( + &self, + device_group_present_capabilities: &mut vk::DeviceGroupPresentCapabilitiesKHR, + ) -> VkResult<()> { + (self.fp.get_device_group_present_capabilities_khr)( + self.handle, + device_group_present_capabilities, + ) + .result() + } + + /// Only available since Vulkan 1.1. + /// + /// + pub unsafe fn get_device_group_surface_present_modes( + &self, + surface: vk::SurfaceKHR, + ) -> VkResult { + let mut modes = mem::zeroed(); + (self.fp.get_device_group_surface_present_modes_khr)(self.handle, surface, &mut modes) + .result_with_success(modes) + } + + /// Only available since Vulkan 1.1. + /// + /// + pub unsafe fn get_physical_device_present_rectangles( + &self, + physical_device: vk::PhysicalDevice, + surface: vk::SurfaceKHR, + ) -> VkResult> { + read_into_uninitialized_vector(|count, data| { + (self.fp.get_physical_device_present_rectangles_khr)( + physical_device, + surface, + count, + data, + ) + }) + } + + /// On success, returns the next image's index and whether the swapchain is suboptimal for the surface. + /// + /// Only available since Vulkan 1.1. + /// + /// + pub unsafe fn acquire_next_image2( + &self, + acquire_info: &vk::AcquireNextImageInfoKHR, + ) -> VkResult<(u32, bool)> { + let mut index = 0; + let err_code = (self.fp.acquire_next_image2_khr)(self.handle, acquire_info, &mut index); + match err_code { + vk::Result::SUCCESS => Ok((index, false)), + vk::Result::SUBOPTIMAL_KHR => Ok((index, true)), + _ => Err(err_code), + } + } + pub const fn name() -> &'static CStr { vk::KhrSwapchainFn::name() }