When a pipeline object is no longer needed and we are sure that it is not being used by the hardware in any of the submitted command buffers, we can safely destroy it.
Destroying a pipeline
How to do it...
- Take the handle of a logical device. Use it to initialize a variable of type VkDevice named logical_device.
- Take the handle of a pipeline object that should be destroyed. Store it in a variable of type VkPipeline named pipeline. Make sure it is not being referenced by any commands submitted to any of the available queues.
- Call vkDestroyPipeline( logical_device, pipeline, nullptr ) for which provide the logical_device and pipeline variables and a nullptr value.
- For safety reasons, assign a VK_NULL_HANDLE value to the pipeline variable.