Destroying a pipeline layout
When we don't need a pipeline layout anymore, and we don't intend to create more pipelines with it, bind descriptor sets or update push constants that used the given layout, and all operations using the pipeline layout are already finished, we can destroy the layout.
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 layout stored in a variable of type
VkPipelineLayout
namedpipeline_layout
. - Call
vkDestroyPipelineLayout( logical_device, pipeline_layout, nullptr )
. For the call, provide thelogical_device
andpipeline_layout
variables and anullptr
value. - For safety reasons, assign a
VK_NULL_HANDLE
to thepipeline_layout
variable.
How it works...
Pipeline layouts are used only in three situations--creating pipelines, binding descriptor sets, and updating push constants. When a given pipeline layout was used only to create a pipeline, it may be destroyed immediately...