Creating a framebuffer
Framebuffers are used along with render passes. They specify what image resources should be used for corresponding attachments defined in a render pass. They also define the size of a renderable area. That's why when we want to record drawing operations, we not only need to create a render pass, but also a framebuffer.
How to do it...
- Take the handle of a render pass that should be compatible with the framebuffer and use it to initialize a variable of type
VkRenderPass
namedrender_pass
. - Prepare a list of image view handles that represent the images' subresources, which should be used for the render pass attachments. Store all the prepared image views in a variable of type
std::vector<VkImageView>
namedattachments
. - Create a variable of type
VkFramebufferCreateInfo
namedframebuffer_create_info
. Use the following values to initialize its members:VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
value forsType
nullptr
value forpNext
0
value forflags
render_pass
variable...