Sign in to follow this  
lomateron

stencil write mask question

Recommended Posts

In the D3D10_DEPTH_STENCIL_DESC there is the StencilWriteMask

 

does someone knows what is the exact operation that is done when writing to the stencil when I have a mask?

 

I think the D3D10_STENCIL_OP_INCR doesn't works when using a writing mask like 11000000(binary)

Edited by lomateron

Share this post


Link to post
Share on other sites

the value that will be written to the stencil buffer is the result of a logical AND of the actual value and the mask ( --> WriteValue = StencilValue & WriteMask ).

Incrementing using that mask does work but it will only save bit 7 and 8, so most likely your stencil value doesn't have those bits set and you end up with zero.

Share this post


Link to post
Share on other sites

yeah, the creators of that write mask should have made possible to add one to just the unmasked bits

That will increase a lot the things that can be done with the stencil thing, and in my case I could have gain a lot of performance, now I have to clear the stencil a lot of times.

Edited by lomateron

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