Vulkan overlay: use the corresponding image index for each swapchain

pImageIndices should be a pointer to the current image index
otherwise every swapchain but the first one could have a wrong image index

Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3741>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3741>
(cherry picked from commit 7283c33b98)
This commit is contained in:
Georg Lehmann 2020-02-06 22:38:35 +01:00 committed by Dylan Baker
parent b23a127258
commit 196a68dfbc
2 changed files with 9 additions and 4 deletions

View file

@ -22,7 +22,7 @@
"description": "Vulkan overlay: use the corresponding image index for each swapchain",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": null
},

View file

@ -1668,15 +1668,18 @@ static VkResult overlay_QueuePresentKHR(
struct swapchain_data *swapchain_data =
FIND(struct swapchain_data, swapchain);
uint32_t image_index = pPresentInfo->pImageIndices[i];
before_present(swapchain_data,
queue_data,
pPresentInfo->pWaitSemaphores,
pPresentInfo->waitSemaphoreCount,
pPresentInfo->pImageIndices[i]);
image_index);
VkPresentInfoKHR present_info = *pPresentInfo;
present_info.swapchainCount = 1;
present_info.pSwapchains = &swapchain;
present_info.pImageIndices = &image_index;
uint64_t ts0 = os_time_get();
result = queue_data->device->vtable.QueuePresentKHR(queue, &present_info);
@ -1688,11 +1691,13 @@ static VkResult overlay_QueuePresentKHR(
VkSwapchainKHR swapchain = pPresentInfo->pSwapchains[i];
struct swapchain_data *swapchain_data =
FIND(struct swapchain_data, swapchain);
uint32_t image_index = pPresentInfo->pImageIndices[i];
VkPresentInfoKHR present_info = *pPresentInfo;
present_info.swapchainCount = 1;
present_info.pSwapchains = &swapchain;
uint32_t image_index = pPresentInfo->pImageIndices[i];
present_info.pImageIndices = &image_index;
struct overlay_draw *draw = before_present(swapchain_data,
queue_data,