mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 15:58:05 +02:00
vulkan/wsi/win32: add wsi_win32_find_idle_image helper
Prepare to handle timeout for sw wsi (no DXGI).
Cc: mesa-stable
(cherry picked from commit 8ff24c7db3)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
This commit is contained in:
parent
b62216f82d
commit
0287336eea
2 changed files with 16 additions and 8 deletions
|
|
@ -634,7 +634,7 @@
|
|||
"description": "vulkan/wsi/win32: add wsi_win32_find_idle_image helper",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -626,6 +626,19 @@ wsi_win32_release_images(struct wsi_swapchain *drv_chain,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static bool
|
||||
wsi_win32_find_idle_image(struct wsi_win32_swapchain *chain,
|
||||
uint32_t *out_image_index)
|
||||
{
|
||||
for (uint32_t i = 0; i < chain->base.image_count; i++) {
|
||||
if (chain->images[i].state == WSI_IMAGE_IDLE) {
|
||||
*out_image_index = i;
|
||||
chain->images[i].state = WSI_IMAGE_DRAWING;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
wsi_win32_acquire_next_image(struct wsi_swapchain *drv_chain,
|
||||
|
|
@ -639,13 +652,8 @@ wsi_win32_acquire_next_image(struct wsi_swapchain *drv_chain,
|
|||
if (chain->status != VK_SUCCESS)
|
||||
return chain->status;
|
||||
|
||||
for (uint32_t i = 0; i < chain->base.image_count; i++) {
|
||||
if (chain->images[i].state == WSI_IMAGE_IDLE) {
|
||||
*image_index = i;
|
||||
chain->images[i].state = WSI_IMAGE_DRAWING;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
}
|
||||
if (wsi_win32_find_idle_image(chain, image_index))
|
||||
return VK_SUCCESS;
|
||||
|
||||
assert(chain->dxgi);
|
||||
uint32_t index = chain->dxgi->GetCurrentBackBufferIndex();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue