Render into another FrameBuffer

#1

I’m trying to understand how the process of “binding” different render passes work in the same commandBuffer for doing full screen post processing effects.

In opengl it’s pretty clear that when we bind a frameBuffer and render into its attachment, we can then later bind this attachment as a regular texture :

glBindFramebuffer(GL_FRAMEBUFFER, hdrFBO);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);  
glBindFramebuffer(GL_FRAMEBUFFER, 0);
hdrShader.use();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, hdrColorBufferTexture);
RenderQuad();

the line 6 is pretty clear that we bind the previus framebuffer colorAttachment as a texture. However reading the sascha willems radial blur example I can’t see what’s the equivalent process of that. I can’t see the conection betwen the render passes, where exactaly is it saying that the attachment of using in one renderpasse’s frameBuffer is going to be used as input to another.

Sorry if i didn’t made myself clear.

SaschaWillems radial blur example: https://github.com/SaschaWillems/Vulkan/blob/master/examples/radialblur/radialblur.cpp

#2

Is it really “pretty clear”? I would say that it’s only clear if you know that hdrColorBufferTexture is a texture that is somewhere in hdrFBO. After all, you didn’t show any of the setup code for hdrFBO, so I only have your word that you attached hdrColorBufferTexture to hdrFBO.

It says exactly what your code says. In one renderpass, you can see that a texture is being used as a renderpass attachment by its presence in a VkFramebuffer. At some point during the rendering of the second renderpass, you can see that this same texture is being used in a texture descriptor and not in that renderpass’s VkFramebuffer. There should of course be some kind of barrier or external subpass dependency ensuring that the previous renderpass finishes with the texture before the subpass containing the commands that read from that texture.

I’m not going to go through the near 700 lines of code to find the exact location where these things are, but those will be what you’re looking for.

#3

Thank you. I haven’t notice that the attachment is used in the second render pass a Image Descriptor.