for (i = 0; i < demo->swapchainImageCount; i++) {
vkDestroyImageView(demo->device, demo->buffers[i].view);
- vkDestroyCommandBuffer(demo->device, demo->buffers[i].cmd);
+ vkFreeCommandBuffers(demo->device, demo->cmd_pool, 1, &demo->buffers[i].cmd);
}
free(demo->buffers);
+ vkDestroyCommandPool(demo->device, demo->cmd_pool);
+
// Second, re-perform the demo_prepare() function, which will re-create the
// swapchain:
vkDestroyDescriptorPool(demo->device, demo->desc_pool);
if (demo->setup_cmd) {
- vkDestroyCommandBuffer(demo->device, demo->setup_cmd);
- demo->setup_cmd = 0; // Must clear this value
+ vkFreeCommandBuffers(demo->device, demo->cmd_pool, 1, &demo->setup_cmd);
}
- vkDestroyCommandBuffer(demo->device, demo->draw_cmd);
+ vkFreeCommandBuffers(demo->device, demo->cmd_pool, 1, &demo->draw_cmd);
vkDestroyCommandPool(demo->device, demo->cmd_pool);
vkDestroyPipeline(demo->device, demo->pipeline);
vkDestroyImage(demo->device, demo->depth.image);
vkFreeMemory(demo->device, demo->depth.mem);
+ free(demo->buffers);
+
// Second, re-perform the demo_prepare() function, which will re-create the
// swapchain:
demo_prepare(demo);