PDA

View Full Version : Sudden performance plummet



Bitterman
11-02-2013, 08:50 AM
So I render everything I have on-screen from a single big VBO, about 22 mbs in size, with the vertex data being 64 bits in size. I seem to be getting a performance drop when I render models, and it seems to be only in some places, and funnily enough, in some angles. It seems, that even though my view origin is in the same spot, and the amount of polies being processed is the same, depenging on what angle I look in, performance is either excellent as usual, or it suddenly plummets down to about 30 fps, from the standard of 60+ fps. As I said, polycounts are the same, and I can solely trace this to my glDrawElements calls with the profiler. I also use an element array to store my unsigned int index array.

And the weird thing is, with models, the performance drop is not gradual. It's either a perfect 60+ fps, or a very sudden drop to 29-30 fps. The models are being drawn in multipass, which looks like this:
1 - One pass with all non-shadowed per-pixel lights and ambient lighting
2 - One renderpass for each texture-based projected light, with optional shadows
3 - One pass for textures
4 - Another for fog

I really don't understand this behaviour, has anyone else ever encountered this?

carsten neumann
11-02-2013, 09:08 AM
Sounds to me that you have vsync enabled, and normally your time for a frame is just below 1/60 second, while for some views you just go slightly over and then miss the opportunity to swap buffers and basically sit waiting for the next vsync/buffer swap opportunity.

Bitterman
11-02-2013, 09:24 AM
That was exactly it. Now the lowest it goes is 56 fps or so. And here I was thinking I'm royally screwing something up with my code.

Thanks for your help.

Dark Photon
11-03-2013, 02:57 PM
On that thread, be sure you put a glFinish() after SwapBuffers() before you stop your frame timer. Otherwise you'll get whacky spikes in your timings that come from driver internal buffering details.