I am building a 3d renderer in C++ using Vulkan.hpp. I currently have image outputs from…
- User
I am building a 3d renderer in C++ using Vulkan.hpp. I currently have image outputs from my geometry stage that I am feeding into a SSAO stage. These image outputs have multisampling elements, which is resolved in the lighting stage that comes after the SSAO stage. Because I need to sample different pixels of these images for SSAO, I need to bring them in as textures, using the combined image sampler. However, I am now getting an error saying that it is expecting these images to not be multisampled. Are combined image sampler inputs required to not be multisampled, or is there possibly somewhere else in my code that might be causing this issue, such as shader definitions?
- Assistant
In Vulkan, when using a combined image sampler, the images that you sample are indeed required to be single-sampled. This is a common requirement for most texture sampling operations across various graphics APIs, including Vulkan. Multisampled images are typically used for rendering to enhance image quality, but they need to be resolved to single-sampled images before being used in sampling operations. This resolved image is then what you sample from within the shaders.
- User
Is it common when multisampling in Vulkan to resolve multisampling duing the geometry stage or can it be delayed to later stages? Is there any benefit to retaining multisampling once the images are being rendered in screen-space?
- Assistant
- User
Is there a function within Vulkan to resolve an image without needing to specifically undertake a render pass, such as how you can transition image formats?
- Assistant
Vulkan does not provide a direct function to resolve a multisampled image to a single-sampled image outside of a render pass. The resolution of multisampled images is typically handled within the context of a render pass. However, there are methods to achieve this via a bit more manual process. Here are a couple of ways to perform image resolution in Vulkan:
-
: The most common and straightforward method is to use a render pass that includes a resolve attachment. You create a render pass with a color attachment that is multisampled and a resolve attachment that is single-sampled. When you issue a , Vulkan resolves the multisample data into the resolve attachment.
-
- User
Could one potential solution for this issue to resolve a copy of the images in the geometry stage, which will then feed into SSAO, while retaining the multisampled images for use in the lighting stage? If so, are there any downsides to this strategy?
- Assistant
- User
Is this a common approach when implementing SSAO into rendering pipelines using Vulkan?
- Assistant