Sign in to follow this  
Followers 0
grunt123

how to copy depthstencil rendertarget

3 posts in this topic

... without using copyresource/copysubresource?

 

i need to copy depth/stencil from one depth target to another using blitting screen aligned rectangle (via shader). i'm able to copy depth info, but somehow stencil info is lost.  (i'm guessing it's prolly source shader resource view is R24_X8 type ... )

 

any idea?

0

Share this post


Link to post
Share on other sites

You can't directly write to the stencil buffer using a pixel shader like you can with depth using SV_Depth. The only way to write to the stencil buffer is to do it indirectly using a depth/stencil state. You can read the stencil data if you want, but that's not very helpful in your case. Note that to read stencil you have to create a separate shader resource view using DXGI_FORMAT_X24_TYPELESS_G8_UINT, and bind it as a separate texture. The stencil data will then be in the green channel of the texture when you sample it in the shader.

Do you actually use multiple stencil buffer values? It would be possible to "copy" the stencil value by doing 1 extra pass per stencil bit. So if you were only using 1 bit, you could fill the stencil using 1 extra pass after the depth fill pass. If you were using all possible values, then you would need 8 extra passes.

2

Share this post


Link to post
Share on other sites
Jep, eight passes for 8 bits. But now I'm wondering if one could write all bits with just four passes...
0

Share this post


Link to post
Share on other sites

You want to use Z-S of target A but output to target B, not discading target A data?

Hmmm, there is MRT, and in case of MRT (multiple render targets), you output the value to more targets, but pixel treatment logic behaves on Z-S of target 0. Try speculating on this.

0

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  
Followers 0