zink: also cache swapchain semaphores

a semaphore is a semaphore, as they say

Fixes: 7399b2241f ("zink: move semaphore caching to zink_reset_batch_state()")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22935>
(cherry picked from commit e9f18f64b9)
This commit is contained in:
Mike Blumenkrantz 2023-05-09 10:14:20 -04:00 committed by Eric Engestrom
parent 752c2f6643
commit 34936765d4
2 changed files with 7 additions and 4 deletions

View file

@ -121,7 +121,7 @@
"description": "zink: also cache swapchain semaphores",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "7399b2241f86bf6106bfb4fb3dacdea010debc59"
},

View file

@ -146,13 +146,16 @@ destroy_swapchain(struct zink_screen *screen, struct kopper_swapchain *cswap)
if (!cswap)
return;
for (unsigned i = 0; i < cswap->num_images; i++) {
VKSCR(DestroySemaphore)(screen->dev, cswap->images[i].acquire, NULL);
simple_mtx_lock(&screen->semaphores_lock);
util_dynarray_append(&screen->semaphores, VkSemaphore, cswap->images[i].acquire);
simple_mtx_unlock(&screen->semaphores_lock);
}
free(cswap->images);
hash_table_foreach(cswap->presents, he) {
struct util_dynarray *arr = he->data;
while (util_dynarray_contains(arr, VkSemaphore))
VKSCR(DestroySemaphore)(screen->dev, util_dynarray_pop(arr, VkSemaphore), NULL);
simple_mtx_lock(&screen->semaphores_lock);
util_dynarray_append_dynarray(&screen->semaphores, arr);
simple_mtx_unlock(&screen->semaphores_lock);
util_dynarray_fini(arr);
free(arr);
}