OpenGL swapBuffers / wglSwapLayerBuffers stutter

Started by
3 comments, last by DerTroll 5 years ago

I've attached a timing graph. the "debug" spikes are actual swapBuffers calls measured with hires performance timers, red line is "whole" 1 single frame time. 

 

I cannot seem to be able to solve this mistery, so what would cause stutter / spikes when calling swapbuffers? This is on windows 10, amd gpu and all drivers installed correctly, i will greatly appreciate any kind of help. 

 

swapbuffers.png

Projects: Top Down City: http://mathpudding.com/

Advertisement

I am no expert but maybe it is related to VSync. With active VSync you can't swap the buffers while the current front buffer is read to display the content on the monitor. The driver blocks the buffer swap until this process has finished.

The spikes might be situations when you issue a swapbuffers shortly after the monitor starts to update the displayed picture.

If you have a constant frame rate, VSync is turned on.

Vsync is off, using call to wglSwapIntervalEXT(0), so it cannot be that :(

The spikes in swapbuffers happen with vsync on and off, it makes no difference. 

 

Game is FPS locked to 30fps via internal frame rate limiter, the limiter's wait time is also shown on the chart, under "sleep" color. 

 

Projects: Top Down City: http://mathpudding.com/

To be really sure I would turn off the custom frame rate limiter and check if you really get an unbound frame rate. I didn't find a source by a quick search but I remember that there are some issues with wglSwapIntervalEXT. It sometimes gets ignored. So just using wglSwapIntervalEXT(0) does not guarantee that VSync is turned off.

If VSync is not the problem you should check your code for implicit synchronizations: https://www.khronos.org/opengl/wiki/Synchronization#Implicit_synchronization 

But except for VSync, I have no idea why a synchronization should cause a stall of exactly one frame. Maybe somebody else does.

 

Greetings and good luck

This topic is closed to new replies.

Advertisement