Jump to content


Inexplicable delay on SwapBuffers?


1 reply to this topic

#1 squint

    New Member

  • Members
  • PipPip
  • 14 posts

Posted 16 March 2008 - 02:06 PM

Hi,
I've been using a 3rd party library for some time which does a lot of OpenGL and, at one particular point, calls SwapBuffers from the WinGdi API. This has worked fine in the past, and I've been getting about 30 FPS. The library also comes with lots of test applications which get a similar frame rate. Recently, the library was updated, and now I get about 2 FPS, without making any other changes, but all the test applications still run fine.

After experimenting with hard coding timers into the code I found that each call to SwapBuffers is taking almost half a second, but only in my application - all the others are fine.

Can anyone think of anything that might cause this? I don't do post processing, I'm not rendering to a texture, I'm not using shaders, I've tried turning vsync on and off - nothing has had any effect. I'm a bit stumped. I can't step into SwapBuffers with the debugger, but simply getting to that line and pressing "step over" is enough to feel the whole thing pause.

It's not eating CPU time - all the other apps in the system run happily at the same time as it.

My last experiment was to call SwapBuffers 20 times in a row in a for loop, with no other calls around it. Total time taken 10 seconds. I'm completely baffled - it doesn't make any sense atall to me - what can it think it has to do in SwapBuffers if I haven't done anything atall since the last one?

What can my app possibly do that changes the time SwapBuffers takes without calling any functions in between one SwapBuffers and the next?

:wallbash:

PS Nvidia GoForce 6100, 2Gb RAM, dual core intel laptop thingy.

#2 squint

    New Member

  • Members
  • PipPip
  • 14 posts

Posted 19 March 2008 - 04:48 PM

I've managed to answer this.
I'm using Visual Leak Detector. With it running SwapBuffers takes between quarter of a second and half a second. Without it I jump to 900 FPS.

Of course, I've always had VLD running and it's never caused this before, and I certainly haven't changed the implementation of swap buffers or installed new drivers lately, so I have no idea WHY, but atleast I can make the problem go away.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users