Jump to content
  • Advertisement
Sign in to follow this  
Jernej.L

OpenGL OpenGL swapBuffers / wglSwapLayerBuffers stutter

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Posted (edited)

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. 

 

Edited by Jernej.L

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!