wsi/win32: Handle acquiring an image while one is already acquired

In the case where the app is attempting to acquire both (since the
min/max num images is 2) swapchain images, we need to wait on the
fence for the next image in the chain.

Reviewed-by: Giancarlo Devich <gdevich@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23222>
This commit is contained in:
Jesse Natalie
2023-05-24 14:33:48 -07:00
committed by Marge Bot
parent 3867e91da4
commit e965b5d291

View File

@@ -648,6 +648,10 @@ wsi_win32_acquire_next_image(struct wsi_swapchain *drv_chain,
assert(chain->dxgi);
uint32_t index = chain->dxgi->GetCurrentBackBufferIndex();
if (chain->images[index].state == WSI_IMAGE_DRAWING) {
index = (index + 1) % chain->base.image_count;
assert(chain->images[index].state == WSI_IMAGE_QUEUED);
}
if (chain->wsi->wsi->WaitForFences(chain->base.device, 1,
&chain->base.fences[index],
false, info->timeout) != VK_SUCCESS)