clear only partial bits of stencil buffer

Started by
3 comments, last by Burnt_Fyr 9 years, 11 months ago

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 ?

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!

The entire stencil must be cleared at once. you cannot just clear a portion of it.

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

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.

This topic is closed to new replies.

Advertisement