i am writing my bachelor-thesis about vulkan and i am currently working on the render-pass section.
I am asking myself if there are more use-cases for more than one subpass as it is for tiled-base renderers (because i never saw an example yet with more than one subpass).
First i thought i can use multiple subpasses for e.g. post-processing but then i learned according to this in the spec:
The subpasses in a render pass all render to the same dimensions, and fragments for pixel (x,y,layer) in one subpass can only read attachment contents written by previous subpasses at that same (x,y,layer) location.
i can only sample from the same fragment location. Does that mean i need always a completely different renderpass for doing things like a gaussian-blur as a post-processing step?
Thanks in Advance
Does that mean i need always a completely different renderpass for doing things like a gaussian-blur as a post-processing step?
Sub-passes are primarily for doing read/modify/write kinds of things, though the write need not be to the same image. The point being that you’re reading from just the pixel that the fragment covers and nothing else. Deferred rendering being a perfect example of this. You read from the g-buffers for a pixel, then do lighting computations and write those values out. Tone mapping is another case where you’re just reading from the specific pixel you’re writing to (though again, to a different image).
You can implement a deferred renderer entirely within a single renderpass.
By using pipeline barriers, you can even create specialized blend functions via read/modify/writes to the same image. You can use the same image as both an input attachment and color attachment in a subpass. Basically, it’s like the old NV/ARB_texture_barrier trick, only it’s almost certainly much more efficient for TBRs, since you’re explicitly telling the renderer that you’re going to do it.
Yes, you can’t get generalized post-processing effects like SSAO, blurring, or whatever within a single renderpass.
The problem is that there are not Compute subpasses (yet).
I don’t see your quote as a problem for most operations.
I fail to see how that would help matters. You still wouldn’t be able to read from arbitrary locations in a render target. At best, a compute subpass might allow you to read the data in the same tile, but even that requires breaking the abstraction a lot.