clearing multiple depth attachments


I want to render a shadow cubemap using a cube compatible/ layerered image and 6 views/attachments.

I thought I might achieve this via subpasses but if I render, only the last attachment is written.
Are multiple depth attachments possible? Or rather can I use multiple depthreferences and swithch between them?
And what am I missing?

Best Regards

A frame buffer can have an arbitrary number of depth and color attachments, so yes, you can create a frame buffer with multiple depth attachments.

Are you using preserve attachments of a subpass to ensure that the depth attachment that has been written by the former subpass is preserved?

I’m not 100% sure what you want to achieve, but since you’re doing cubemap rendering you may want to do this in a single pass with a geometry shaders.

Other than that some additional info would be useful.

Hi and thank you for your reply.

I have a geometry shader sample that renders the scene directly into a cube map:

Now I want to implement your omni sample without the copying and it was suggested that subpasses might be the way to do this, I was not aware of preservation attachments.
Thank you very much, I will educate myself in that direction.