PDA

View Full Version : Masking depth buffer



V-man
01-14-2006, 09:40 PM
Is masking the depth buffer while I update the stencil buffer a bad idea?
I'm talking about 24:8 depth:stencil

I'm interested in older GPUs (Geforce 2) to todays latest.

jide
01-15-2006, 02:29 AM
It depends on the stencil test you make. If that test doesn't need to care about the depth fragment (ie you make the same opearation regardless the depth result), that sounds well. Otherwise this won't be a so great idea :)

But I might not understand your question very well.

V-man
01-15-2006, 05:15 AM
I make these calls

glStencilFunc(GL_GEQUAL, someValue, 0xFFFFFFFF);
glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);

//This is always the case
//glStencilMask(0xFFFFFFFF);

glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);

render_my_stuff();

I might use
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
instead of
glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
when I make a change to the algorithm.

I may or may not use shaders.

The depth func is GL_LEQUAL.

EXT_stencil_clear_tag is only for the Gf6 with Turbocache according to
http://oss.sgi.com/projects/ogl-sample/registry/EXT/stencil_clear_tag.txt

Why this particular GPU?

I am trying to avoid multiple multiple glClear(STENCIL_BIT) in my code and that does boost performance.

jide
01-15-2006, 06:21 AM
I don't know but I guess that the fact that your stencil op changes regarding the z-test pass/fail would not allow you to do so. (you increment if the depth test pass).

If you had glStencilOp (GL_XXX, GL_KEEP, GL_KEEP), I think it would be fine.