In traditional graphics APIs, we start rendering a frame by clearing a render target or a back buffer. In Vulkan, we should perform the clearing by specifying a VK_ATTACHMENT_LOAD_OP_CLEAR value for a loadOp member of the render pass's attachment description (refer to the Specifying attachment descriptions recipe from Chapter 6, Render Passes and Framebuffers). But sometimes, we can't clear an image inside a render pass and we need to do it implicitly.
Clearing a color image
How to do it...
- Take the handle of a command buffer stored in a variable of type VkCommandBuffer named command_buffer. Make sure the command buffer is in the recording state and no render pass has started.
- Take the handle of an image that should be cleared. Provide it through a variable...