Destroying a shader module
Shader modules are used only for creating pipeline objects. After they are created, we can immediately destroy them, if we don't intend to use them anymore.
How to do it...
- Use the handle of a logical device to initialize a variable of type
VkDevice
namedlogical_device
. - Take the shader module's handle stored in a variable of type
VkShaderModule
namedshader_module
. - Call
vkDestroyShaderModule( logical_device, shader_module, nullptr )
providing thelogical_device
variable, theshader_module
variable, and anullptr
value. - Assign a
VK_NULL_HANDLE
value to theshader_module
variable for safety reasons.
How it works...
Shader modules are used only during the pipeline creation. They are provided as part of a shader stages state. When pipelines that use given modules are already created, we can destroy the modules (immediately after the pipeline creating functions have finished), as they are not needed for the pipeline objects to be correctly used by the driver.
Note
Created pipelines...