View Full Version : performance of SwapBuffers in Windows

11-15-2000, 06:11 AM
Though I aspire to have problems that belong in the advanced forum, alas, I am plagued by simpler issues.

After looking through previous posts on this forum, I have gathered that it is possible windows, when you call SwapBuffers(), does not just swap pointers to blocks of memory, but does some sort of Blt to copy the back buffer to the front. As sucky as this may be, it still doesn't explain the performance hit I am seeing.

Running just in windows message loop, drawing nothing and not swapping buffers, I run at about 350-500fps. However, if I insert a call to SwapBuffers(still no drawing), I drop to 11fps. Yes, _11_ fps. I am running in software mode, but I don't think that explains an upper limit of 11fps (without drawing). I'm using a 500x500 window at 24bpp and 16-bit depth buffer. However, even if I use a lesser color depth and depth buffer, it doesn't affect things. Any ideas???

Clearly hardware acceleration would help. However, I need to make sure I run at a decent frame rate in software. Clearly an upper limit of ~11fps is not "decent".

Any help is appreciated.


11-15-2000, 08:31 AM
Hmm. I call Swapbuffers(&hdc) all the time to display the buffer to the screen and no performance hit. Maybe your drivers? I dont know.

11-15-2000, 08:57 AM
Well, I found a few ways to speed this up - I wasn't using the whole window for my viewport, so I turned scissoring on. Used a more precise counter, fixed a minor bug in my fps calculation(was half of what it should be). Got it up to 40fps. This still seems slow, but maybe this is the best I can get out of hardware. Anyone know what I can expect in software? As soon as I start drawing the fps goes to hell - not too much I can do to optimize with a dynamic model.


11-15-2000, 11:31 AM
for windozes theres a hint winswaprecthint (or someit) that lets u specify what region u want to be swapped, it should speed up software swapping by quite a bit