Destroying a descriptor set layout
Descriptor set layouts that are no longer used should be destroyed.
How to do it...
- Provide a logical device's handle using a variable of type
VkDevice
namedlogical_device
. - Take the handle of a created descriptor set layout and use it to initialize a variable of type
VkDescriptorSetLayout
nameddescriptor_set_layout
. - Call
vkDestroyDescriptorSetLayout( logical_device, descriptor_set_layout, nullptr )
and provide handles of the logical device and descriptor set layout, and anullptr
value. - For safety, assign the
VK_NULL_HANDLE
value to thedescriptor_set_layout
variable.
How it works...
Descriptor set layouts are destroyed with the vkDestroyDescriptorSetLayout()
function like this:
if( VK_NULL_HANDLE != descriptor_set_layout ) { vkDestroyDescriptorSetLayout( logical_device, descriptor_set_layout, nullptr ); descriptor_set_layout = VK_NULL_HANDLE; }
See also
See the following recipe in this chapter:
- Creating a descriptor set layout