Destroying a render pass
If a render pass is not needed and it is not used anymore by commands submitted to the hardware, we can destroy it.
How to do it...
- Use the handle of a logical device, on which the render pass was created, to initialize a variable of type
VkDevice
namedlogical_device
. - Store the handle of the render pass that should be destroyed in a variable of type
VkRenderPass
namedrender_pass
. - Call
vkDestroyRenderPass( logical_device, render_pass, nullptr )
and provide thelogical_device
andrender_pass
variables and anullptr
value. - For safety reasons, assign a
VK_NULL_HANDLE
value to therender_pass
variable.
How it works...
Destroying a render pass is performed with just a single function call like this:
if( VK_NULL_HANDLE != render_pass ) { vkDestroyRenderPass( logical_device, render_pass, nullptr ); render_pass = VK_NULL_HANDLE; }
See also
The following recipe in this chapter:
- Creating a render pass