View Full Version : multiple pbuffers and early depth culling

01-24-2005, 12:28 PM
I've done some tests about early depth culling in pbuffers for computation masking, and encountered some problems. Early depth culling is crucial to my work because I run some really expensive fragment programs.

Here's what I've done: Created an rgba32f pbuffer with front/back/aux0123/depth buffers. I've tried two known methods. In the first method, the depth buffer is initialized so that the depth of the pixels to be processed set to 1 and others set to 0, then a primitive with depth 0.5 is drawn. It works fine and does the early z culling. In the second case I've used depth bounds tests which is about %30 faster than the first method. It is also working fine.

A strange problem arises when more than one pbuffers are created. It seems that the early depth culling mechanism works on the firstly created pbuffer only. I couldn't manage it to run on the second pbuffer. This happens only for pbuffers; multiple window render contexts working as expected. Moreover wglMakeCurrent() seems to destroy the optimized z-buffer even if the current context is made current again, so I avoid context changes between passes.

Unfortunately single pbuffer is not enough for my work, because I have to use more than 6 renderable textures (with complex shaders running on them). I also do not want to copy pixels between pbuffers frequently, which would be inefficient.

I've read the specs and could not find anything useful. Has anyone tried early depth testing in multiple pbuffers, and managed it to work on all of them ?

By the way I have 6800gt with 66.93 drivers.