Jump to content
  • Advertisement
Sign in to follow this  
joeblack

clear only partial bits of stencil buffer

This topic is 1588 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

Hi,

i would like to use stencil buffer for two different things, so that first 4 bytes will encode one value and second 4 bytes different value.

 

I can do this by   StencilWriteMask   and StencilReadMask , but my issue is that one value will not change during frame, but second will change multiple times, so i need to clear this value multiple times per frame.

 

When i call ClearDepthStencilView with StencilWriteMask will it only affect chosen values ? Or i need to perform "clean" manually with full screen quad ?

Share this post


Link to post
Share on other sites
Advertisement

As far as I know, it isn't possible to preserve Stencil buffer bits. 

 

When you say bytes, I assume that you are talking about bits. 

 

Cheers!

Share this post


Link to post
Share on other sites

As far as I know, it isn't possible to preserve Stencil buffer bits. 
 
When you say bytes, I assume that you are talking about bits. 
 
Cheers!


Yes, i ment bits, i allways mess it up

Share this post


Link to post
Share on other sites

One option would be to setup a stencil op such as ZERO, or REPLACE ,  in combination with your write mask, and render a full screen quad, so that each pixel of the stencil buffer is written to what you want. This would add some Draw calls, but would get the functionality that you want.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!