a/vk: Add vk_enumerate_swapchain_images

This commit is contained in:
Jakob Bornecrantz 2024-01-01 17:41:27 +00:00 committed by Mateo de Mayo
parent 9a7056fafe
commit ca43f81322
2 changed files with 39 additions and 0 deletions

View file

@ -174,6 +174,32 @@ out:
}
#endif
#ifdef VK_KHR_swapchain
VkResult
vk_enumerate_swapchain_images(struct vk_bundle *vk,
VkSwapchainKHR swapchain,
uint32_t *out_image_count,
VkImage **out_images)
{
VkImage *images = NULL;
uint32_t image_count = 0;
VkResult ret;
ret = vk->vkGetSwapchainImagesKHR(vk->device, swapchain, &image_count, NULL);
CHECK_FIRST_CALL("vkGetSwapchainImagesKHR", ret, image_count);
images = U_TYPED_ARRAY_CALLOC(VkImage, image_count);
ret = vk->vkGetSwapchainImagesKHR(vk->device, swapchain, &image_count, images);
CHECK_SECOND_CALL("vkGetSwapchainImagesKHR", ret, images);
out:
*out_image_count = image_count;
*out_images = images;
return VK_SUCCESS;
}
#endif
#ifdef VK_USE_PLATFORM_DISPLAY_KHR
VkResult
vk_enumerate_physical_device_display_properties(struct vk_bundle *vk,

View file

@ -850,6 +850,19 @@ vk_enumerate_surface_present_modes(struct vk_bundle *vk,
VkPresentModeKHR **out_present_modes);
#endif
#if defined(VK_KHR_swapchain) || defined(XRT_DOXYGEN)
/*!
* Enumerate the images of the given @p VkSwapchainKHR.
*
* @ingroup aux_vk
*/
VkResult
vk_enumerate_swapchain_images(struct vk_bundle *vk,
VkSwapchainKHR swapchain,
uint32_t *out_image_count,
VkImage **out_images);
#endif
#if defined(VK_USE_PLATFORM_DISPLAY_KHR) || defined(XRT_DOXYGEN)
/*!
* Enumerate the display properties of the given @p VkPhysicalDevice.