Windows 8.1 64-bit
GEForce 780
Driver 347.52
I have two programs that render the scene to a texture, then draw the texture onscreen:
http://www.leadwerks.com/post/fbotest.zip
“FBO Off.exe” runs at 1000 FPS.
The program “FBO On.exe” only differs by the creation of a bunch of FBOs at the beginning of the program:
for (int n = 0; n < 36 * 6; n++)
{
uint32 framebuffer;
glGenFramebuffers(1, &framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);
}
glBindFramebuffer(GL_FRAMEBUFFER, 0);
This program runs at 500-700 FPS, though the FBOs are never used and the rest of the code is identical.
Why would anyone want to create 216 FBOs? Well, with shadow mapping that accounts for 36 point lights and is not an unreasonable amount. We accidentally discovered this when a simple scene with 36 point lights experienced a huge drop in framerate when our cached shadowmaps were in use, which use an extra FBO to render static geometry:
Even if FBOs should be shared across different shadow maps, it still makes no sense for an inactive FBO to have any effect on rendering performance, and I would classify this as a bug.