Why can only one DepthStencilAttachment be specified in VkSubpassDescription?

Why can only one DepthStencilAttachment be specified in VkSubpassDescription? What if I want a shader to write to multiple ColorAttachments at the same time and use their DepthStencilAttachment for postprocessing, for example?

write to multiple ColorAttachments at the same time and use their DepthStencilAttachment

Color attachments are not associated with depth attachments. There is no “their” association.

A subpass has color attachments and a single depth/stencil attachment. All depth operations apply to the depth attachment. All stencil operations apply to the stencil attachment.

Depth and stencil operations aren’t just shader operations; they have intrinsic hardware associated with them that keeps them fast. Part of the limitations of that (besides sanity) is that there is only one of each of them.

1 Like

Thanks for the reply. I thought about it a bit and realized that I don’t understand how the late fragment test works. I didn’t find anything about the principle of operation in the specification (it’s quite possible that I didn’t notice something). Can you recommend an article about it or give me a link to the section of the specification where it is written about it?

You just deleted and reposted the exact same message from a day ago, presumably so that people would be re-alerted to your reply.

Don’t do that again.

The thing is that when I write a message for the first time, it doesn’t show up as a reply, but when I send it again, it does. And I want to make sure that you will be notified of my reply, but if it reaches you as a reply to your message, then I won’t bother and duplicate the message anymore.