What is worse, rewiring RenderPass attachments or additional RenderPasses?

I want to set up a system for “hot-loading” RenderPasses, for an end goal along the lines of “I’m not using post-processing in this scene, so let’s remove the RenderPass for it. Now in the next scene, I need it again, so add it back in.”.

I was in the process of thinking about how to handle clearing the screen in the beginning, and presenting in the end.

“Rewiring” the attachments of the RenderPasses when the chain changes seems doable, but might get somewhat complex.

However, is it better to just have a chain like S-H-H-H-E, where S is the start RenderPass that only clears the screen, E is the end RenderPass that only presents, and H are the RenderPasses that can be “hot-loaded” in or out?

In the meantime I found this stackoverflow answer, which hints that it’s possible to simply clear the screen without using a RenderPass for it:

You could stop clearing the attachments on load. Just manually clear them, either before the render pass begins or at the start of the first subpass.

vkCmdClearColorImage should do the trick.


However, that answer also mentions

That being said, render passes are not cheap, and this is really not the way to use them. The correct solution is to restructure your rendering code so that you only need a single render pass.

Info about the neighbouring pixels of a given pixel is often a requirement for post-processing effects. That’s not possible with a single RenderPass. So our hand is forced in that case, but otherwise we should not introduce additional RenderPasses.

This means a "static’ setup of one offscreen RenderPass for the geometry, and one post-processing RenderPass should work for most cases. While “hot-loading” might be more desirable for subpasses than RenderPasses.