Sign in to follow this  
Ponkx

Reading bound depth stencil resource

Recommended Posts

Ponkx    117
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
Ponkx    117
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this