Jump to content

  • Log In with Google      Sign In   
  • Create Account

how to copy depthstencil rendertarget


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 grunt123   Members   -  Reputation: 177

Like
0Likes
Like

Posted 04 September 2013 - 05:38 PM

... 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?



Sponsor:

#2 MJP   Moderators   -  Reputation: 11737

Like
2Likes
Like

Posted 04 September 2013 - 10:59 PM

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.



#3 unbird   Crossbones+   -  Reputation: 6007

Like
0Likes
Like

Posted 05 September 2013 - 01:57 PM

Jep, eight passes for 8 bits. But now I'm wondering if one could write all bits with just four passes...

#4 JohnnyCode   Members   -  Reputation: 292

Like
0Likes
Like

Posted 05 September 2013 - 03:22 PM

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS