Jump to content
  • Advertisement
Sign in to follow this  
Ponkx

Reading bound depth stencil resource

This topic is 3001 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I needed to use depth stencil resource in the shader, but at the same time I need to bound this resource as the render target. But because this is impossible to do in DX10, I had to overcome this problem somehow. First solution is to use DX9 approach - this means create another resource, and during depth fill bind that resource and store depth info into it. This has the disadvantage, that resource must be cleared with the regular depth stencil buffer. So, next I was trying to create another resource again, but when finishing depth rendering, use CopyResource to copy this depth-stencil buffer into it. So now instead of clearing the buffer there is a copy. I did some tests and it seems, that for depth buffer without stencil this copy is faster. BUT, for depth buffer with stencil I cannot find any suitable format for destination, for which this CopyResource would be possible to do. Could anyone help? Is this copy even possible? In DX10 help is mentioned, that depth-stencil resources cannot be used as a destination. But I'm using it as source, so this should be OK. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Well, problem solved - I had set BindFlags to D3D10_BIND_RENDER_TARGET. That's why I couldn't create the texture. Now it works, and it's still faster than that first solution with clear and write depth along normal depth pass....

Anyway, does anyone know if it is possible to avoid this copy somehow?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!