wsi/common: Add common implementation of vkReleaseSwapchainImagesEXT.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Joshua Ashton <joshua@froggi.es>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20235>
This commit is contained in:
Hans-Kristian Arntzen
2022-12-08 17:07:52 +01:00
committed by Marge Bot
parent c1fa7fe785
commit 8ece1ade5b
2 changed files with 26 additions and 0 deletions
+23
View File
@@ -987,6 +987,29 @@ wsi_DestroySwapchainKHR(VkDevice _device,
swapchain->destroy(swapchain, alloc);
}
VKAPI_ATTR VkResult VKAPI_CALL
wsi_ReleaseSwapchainImagesEXT(VkDevice _device,
const VkReleaseSwapchainImagesInfoEXT *pReleaseInfo)
{
VK_FROM_HANDLE(wsi_swapchain, swapchain, pReleaseInfo->swapchain);
VkResult result = swapchain->release_images(swapchain,
pReleaseInfo->imageIndexCount,
pReleaseInfo->pImageIndices);
if (result != VK_SUCCESS)
return result;
if (swapchain->wsi->set_memory_ownership) {
for (uint32_t i = 0; i < pReleaseInfo->imageIndexCount; i++) {
uint32_t image_index = pReleaseInfo->pImageIndices[i];
VkDeviceMemory mem = swapchain->get_wsi_image(swapchain, image_index)->memory;
swapchain->wsi->set_memory_ownership(swapchain->device, mem, false);
}
}
return VK_SUCCESS;
}
VkResult
wsi_common_get_images(VkSwapchainKHR _swapchain,
uint32_t *pSwapchainImageCount,
+3
View File
@@ -188,6 +188,9 @@ struct wsi_swapchain {
VkResult (*wait_for_present)(struct wsi_swapchain *swap_chain,
uint64_t present_id,
uint64_t timeout);
VkResult (*release_images)(struct wsi_swapchain *swap_chain,
uint32_t count,
const uint32_t *indices);
};
bool