Similarly to color images, we sometimes need to manually clear a depth-stencil image outside of a render pass.
Clearing a depth-stencil image
How to do it...
- Take the command buffer that is in a recording state and has no render pass currently started in it. Using its handle, initialize a variable of type VkCommandBuffer named command_buffer.
- Take the handle of a depth-stencil image and store it in a variable of type VkImage named image.
- Store the value representing the layout, in which the image will have during clearing, in a variable of type VkImageLayout named image_layout.
- Create a variable of type std::vector<VkImageSubresourceRange> named image_subresource_ranges, which will contain a list of mipmap levels of all the image's and array layers, which...