Shadowbuffers: FBO and double-speed Z-only


While implementing shadow-buffers, I’ve got some interesting and unexpected results.

I’ve got 4096*4096 2D depth texture (DEPTH_COMPONENT or DEPTH_STENCIL, doesn’t matter) and 2D RGBA8 color texture as color attachement or no color attachment at all. I expected to get benefits from double-speed z-only pass. ColorMask were set to FALSE, no tex-kills applied, even no tex-lookups were done.
I concentrated on the most hard case expecially, where overdraw were quite big, to see if I get any improvements.
I had 570 draw calls with 1209K vertices and 1840K indices.
I’ve mesured GPU timings via NV_timer_query.

Test system - WinXP, Core2Duo, 8800 GTX, 158.22 drivers.

These are the results:

ColorMask(1,1,1,1), ColorAtt=RGBA - RenderTime=17.22 mS
ColorMask(0,0,0,0), ColorAtt=NONE - RenderTime=20.03 mS

I found it very strange and decided to make some experiments with it.
Enabling color atatchment and color writes, and doing random color masks between draw calls gave me very strange results - from start to start render time wasn’t constant, but, surely, it was constant during program run. The strange thing is that this render time doesn’t flow, but is from the set of 3 values: 18.02 mS, 17.22 mS, 16.65 mS. The smaller is the time - the more rare I’ve got it.

So, the question is how can I get double-speed Z-only???

disable the draw buffer

draw buffer and read buffer are already set to NONE

I don’t have anything helpful to say except that when I tried to do the same a while ago for shadow mapping, I didn’t succeed to benefit from double-speed Z either.



by the way, when rendering to screen framebuffer, not to FBO, benefit is quite evident, about 50% gain, as promised.

May be, this is some kind of FBO feature?
May be, I should create FBO based on RECTANGLE depth texture, not 2D?