PDA

View Full Version : glFramebufferRenderbufferEXT and glDepthMask



heppe
03-26-2009, 02:40 PM
if you have a secondary render target bound as in

glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, buffer);

should it respect the state of glDepthMask?

Our findings seem to indicate that it doesn't, neither on NVidia nor AMD implementations (unless there was something wrong with our tests, which I can't completely rule out).

If the answer is that depth is written regardless of glDepthMask state, is the recommended way to prevent such depth writing to temporarily unbind the depth render target?

Thanks,

-Travis

ruysch
03-28-2009, 01:52 PM
The renderbuffer object does respect the state of glDepthMask, or that is its the framebuffer object that respect the depth mask though thats semantics I guess.

If you could supply a tiny snippet showing how your tests indicates that this isnt true it might be easier to pin point your errors ;-)

dletozeun
03-28-2009, 03:38 PM
AFAIK, fbo are the same thing as the default framebuffer provided by the window system. Like this last one, they have their own states so IMO, the depth writing state is framebuffer dependant and may varies depending on the bound framebuffer name. I think it must be somewhere in the spec. :)

Jan
03-28-2009, 04:29 PM
As said above FBOs do have their own states. That means you need to first bind the FBO, then set the states, such as depth-mask, color-mask, etc. and then perform the operations that should be masked. If you first set the masks and then bind the FBO, it will actually be applied to the wrong buffer and not work as expected.

Jan.

V-man
03-29-2009, 08:01 AM
As said above FBOs do have their own states. That means you need to first bind the FBO, then set the states, such as depth-mask, color-mask, etc. and then perform the operations that should be masked. If you first set the masks and then bind the FBO, it will actually be applied to the wrong buffer and not work as expected.

Nope.
You should be able to set any state that you want, even before binding a FBO. glDepthMask, glEnable, glBlendFunc and all the other states. These are suppose to be GPU states.

Ilian Dinev
03-29-2009, 08:50 AM
Reading through http://www.opengl.org/registry/specs/ARB/framebuffer_object.txt
See table 4, table 5, table 8. These are the only states, local to a fbo. Blending, masks, etc - are not local, from what I read.

dletozeun
03-29-2009, 09:18 AM
My mistake, V-man is right. But I can't understand why depth masking is not fbo dependant.
Ilian, I can't find something about depth masking in per fbo states.
Furthermore the gl spec is not very explicit about that and I understood the contrary reading "4.2 Whole framebuffer operations" Because I expected to find in this section operations that affect the whole fbo (as the title says) and not operations that affects also all created framebuffers (window system and application ones).