Destroying a pipeline
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.
How to do it...
- Take the handle of a logical device. Use it to initialize a variable of type
VkDevice
namedlogical_device
. - Take the handle of a pipeline object that should be destroyed. Store it in a variable of type
VkPipeline
namedpipeline
. 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 thelogical_device
andpipeline
variables and anullptr
value. - For safety reasons, assign a
VK_NULL_HANDLE
value to thepipeline
variable.
How it works...
When a pipeline is no longer needed, we can destroy it by calling the vkDestroyPipeline()
function like this:
if( VK_NULL_HANDLE != pipeline ) { vkDestroyPipeline( logical_device, pipeline, nullptr ); pipeline = VK_NULL_HANDLE; }
Pipeline objects...