Waiting for all submitted commands to be finished
Sometimes we would like to wait until all the work submitted to all the logical devices' queues is finished. This type of wait is typically done before we close our application and we want to destroy all created or allocated resources.
How to do it...
- Take the handle of a created logical device and store it in a variable of type
VkDevice
namedlogical_device
.
- Make the following call:
vkDeviceWaitIdle( logical_device )
, for which provide the handle of the logical device. - You can check if there were no errors by comparing the returned value with a
VK_SUCCESS
.
How it works...
The vkDeviceWaitIdle()
function causes our application to wait until a logical device is no longer busy. This is similar to waiting on all queues requested for a given device--until commands, which were submitted to all queues, are finished.
The above function is usually called just before the exit from our application. When we want to destroy resources, we must make sure they...