Confusing RenderPass usage in different places

Hello,

at the moment I am a bit confused by Vulkan’s RenderPass usage.

  • We have to provide a RenderPass when creating a Pipeline via GraphicsPipelineCreateInfo().
  • We have to provide a RenderPass when creating a Framebuffer via FramebufferCreateInfo().
  • We have to provide a RenderPass when we ‘beginRenderPass’ via RenderPassBeginInfo().

I assume this RenderPass is the same object in all 3 cases (note that the FrameBuffer is used in RenderPassBeginInfo())?

If yes, does this mean that when recording multiple render passes via multiple beginRenderPass()
calls, the RenderPass object in RenderPassBeginInfo() always stays the same and only the
other components of the RenderPassBeginInfo() like RenderArea or PClearValues might change?

If no, how does it work at all? What RenderPass object do we have to provide when creating
the pipeline and framebuffer when we are using a different RenderPass object in each
RenderPassBeginInfo()?

Clarification is very appreciated!

It must be “the same” if you want to use that framebuffer when you begin that render pass, and if you want to use that pipeline within that render pass instance. So more accurately, when you begin a render pass instance, the framebuffer you provide must have used “the same” render pass on its creation. And when you bind a graphics pipeline, the render pass (and subpass) it uses must be “the same” as the render pass that is currently active (either through a BeginRenderPass call or a secondary command buffer that inherits render pass state).

By “the same”, that does not necessarily mean the exact same VkRenderPass object. Merely one that is “compatible” with it. But compatibility is so narrowly defined that this means that only two render passes created with identical creation parameters will be compatible.

1 Like

Thanks a lot for your answer Alfonse! :+1: