That's really strange. Look at the code
CRenderer::setRenderTarget(&sceneRenderTarget);
CRenderer::setDepthStencilSurface(&sceneDepthStencilSurface); // scene depth-stencil
CRenderer::clear(true, true, false, CVector3(0.0f, 0.0f, 0.0f));
CRenderer::setDepthStencilSurface(&someDifferentDepthStencilSurface);
CRenderer::setDepthStencilSurface(&sceneDepthStencilSurface); // again scene depth-stencil
After the last two lines of code above, I simply get black screen after anything is rendered. But when I do:
...
CRenderer::setDepthStencilSurface(&someDifferentDepthStencilSurface);
CRenderer::setDepthStencilSurface(&sceneDepthStencilSurface); // again scene depth-stencil
CRenderer::clear(true, true, false, CVector3(0.0f, 0.0f, 0.0f));
It's all okay. So it looks like sceneDepthStencilSurface gets some rubbish-data. That's annoying cause I need to "switch for a moment" a depth-stencil surface (and render target) to do some rendering and then get back to the previous depth-buffer. Moreover, if I use default back-buffer's depth-stencil instead of additional sceneDepthStencilSurface, it's all fine. And this only happens in Debug mode, not Retail. Is this some driver bug or what? Can I do this and be sure that it would work on any machine at Retail-DX-mode?