wsi/metal: Fix command buffer release at destroy
Fixes: 39a7d65113 ("wsi/metal: Backend addition for drivers built on top of Metal")
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Signed-off-by: Aitor Camacho <aitor@lunarg.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38785>
This commit is contained in:
@@ -525,16 +525,22 @@ wsi_metal_destroy_image(const struct wsi_metal_swapchain *metal_chain,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Required since we allocate 2 per queue */
|
/* Required since we allocate 2 per queue, stored with the following layout:
|
||||||
|
* cmd_pool 0: 0, queue_count
|
||||||
|
* cmd_pool 1: 1, 1 + queue_count
|
||||||
|
* ...
|
||||||
|
*/
|
||||||
if (image->blit.cmd_buffers) {
|
if (image->blit.cmd_buffers) {
|
||||||
int cmd_buffer_count =
|
int queue_count =
|
||||||
chain->blit.queue != NULL ? 2 : wsi->queue_family_count * 2;
|
chain->blit.queue != NULL ? 1 : wsi->queue_family_count;
|
||||||
|
|
||||||
for (uint32_t i = 0; i < cmd_buffer_count; i++) {
|
for (uint32_t i = 0; i < queue_count; i++) {
|
||||||
if (!chain->cmd_pools[i])
|
if (!chain->cmd_pools[i])
|
||||||
continue;
|
continue;
|
||||||
wsi->FreeCommandBuffers(chain->device, chain->cmd_pools[i],
|
wsi->FreeCommandBuffers(chain->device, chain->cmd_pools[i],
|
||||||
1, &image->blit.cmd_buffers[i]);
|
1, &image->blit.cmd_buffers[i]);
|
||||||
|
wsi->FreeCommandBuffers(chain->device, chain->cmd_pools[i],
|
||||||
|
1, &image->blit.cmd_buffers[i + queue_count]);
|
||||||
}
|
}
|
||||||
vk_free(&chain->alloc, image->blit.cmd_buffers);
|
vk_free(&chain->alloc, image->blit.cmd_buffers);
|
||||||
image->blit.cmd_buffers = NULL;
|
image->blit.cmd_buffers = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user