How to resolve multi-sampled depth images?

I’m using a Forward+ rendering pipeline with multi-sampled render targets for the depth pre-pass and the main render-pass. I don’t need multi-sampled images for post-processing and such, which is why I’d resolve the render targets after the main render-pass and then continue with the resolved images from there.
In OpenGL you could resolve both color and depth images using glBlitFramebuffer, however it seems that Vulkan doesn’t provide any method for resolving depth images, which is problematic since I need the depth buffer for some post-processing effects.

Is there any way to resolve a depth image manually? If not, what’s the proper way of working with MSAA? Should I just use multi-sampled images throughout the entire pipeline and only resolve the color image at the end before presenting? That seems like a waste of resources to me.

I don’t know what problem you’re having. The only format restriction that vkCmdResolveImage has is that the source and destination image formats must match. There’s nothing that says that depth images cannot be resolved.

Yes, resolve attachments must use color attachments as their source. But since you’re already breaking up your rendering into two render passes, you can use vkCmdResolveImage between them.

Should I just use multi-sampled images throughout the entire pipeline and only resolve the color image at the end before presenting?

Well, that is kind of the point of multisampling. Especially if you’re going to do arbitrary computations on the depth values, since those values will impact your aliasing.

There’s nothing that says that depth images cannot be resolved.

VUs:

The format features of dstImage must contain VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT.

The aspectMask member of srcSubresource and dstSubresource must only contain VK_IMAGE_ASPECT_COLOR_BIT

@SilverIan
It is not clear what you actually want as a result from “resolving” a depth image. Arithmetic mean? That somewhat only makes sense for color. For depth it would average in values from near and far objects, which sounds like a non-sense operation to me.

Would it not have been easier to just say that the formats for the two images must be color formats? I mean, is there some expectation that there will someday be color/depth textures?

[QUOTE=Alfonse Reinheart;43877]

Well, that is kind of the point of multisampling. Especially if you’re going to do arbitrary computations on the depth values, since those values will impact your aliasing.[/QUOTE]
Well, as an example, I need the depth buffer for SSAO. However, since the SSAO image will be blurred anyway, it doesn’t really matter whether or not the source images for the SSAO shader are multi-sampled. Since using multi-sampled images is much more expensive, it should be more efficient to resolve the images first, and then work with the single-sampled images. Should I not do that?

[QUOTE=krOoze;43878]
It is not clear what you actually want as a result from “resolving” a depth image. Arithmetic mean? That somewhat only makes sense for color. For depth it would average in values from near and far objects, which sounds like a non-sense operation to me.[/QUOTE]
I suppose that’s true, what does OpenGL do when you resolve a depth image?

Well it is what the first VU says in a round-about way. Maybe someone thought it is less brittle to write it that way. “Color”, or “depth format” are perhaps somewhat more colloquial terms than a FEATURE flag. It is better to err on the side of unambiguity, even if sometimes it produces offputting wording – it suits Vulkan nicely.
Also wrong person to ask; I know as much as you do.