Share depth buffer?

Hi, does Monogame also have the restriction that XNA had, that a depth buffer is locked into a single rendertarget? Some work I’m doing requires me to change render targets, but keep the same depth buffer so when I draw anything behind what has already drawn it is discarded.

Currently, after switching rendertarget, I’m passing the depthbuffer in to a shader and drawing a fullscreen quad to ‘restore’ the depth. Is this really all I can do? Seems really wasteful and surely impacts performance quite significantly?

well you can’t directly use the depth buffer of another rendertarget as far as I am aware.

The way I do it is to draw to multiple rendertargets at once and let one of them be a depthbuffer. Then I pass this rendertarget as a texture to the others which need it (for example for soft shadows, post processing/distortion effects)