[osg-users] Enabling Vsync gives dramatic increase in latency

Björn Blissing bjorn.blissing at vti.se
Wed May 13 08:28:11 PDT 2015


Jan Ciger wrote:
> 
> Did you try to call glFlush() at the end of the each frame in your OpenGL application? That should force the driver to not buffer but to actually hold your program until the vsync event. Right now you are rendering much faster than the GPU can scan out, so your program blocks only once the rendering queue becomes full - which seems to be about the 3 frames of latency. 
> 
> glFlush() is bad for performance because it stalls the GPU on every frame but should lower the latency from the fixed 60ms you see with vsync on. 
> 


No, I did not since I thought that a call to SwapBuffers incurred a implicit flush of the pipeline. So I experimented with calling glFlush() before and after the call to the SwapBuffer function. I also tried calling glFinish() before and after the call to the SwapBuffer function:

glFlush() before SwapBuffers: Min: 57.9 Max: 66.0 Avg: 61.2
glFlush() after SwapBuffers: Min: 50.9 Max: 64.1 Avg: 60.9
glFinish() before SwapBuffers: Min: 38.9 Max: 47.1 Avg: 43.0
glFinish() after SwapBuffers: Min: 19.9 Max: 26.0 Avg: 23.2

So glFlush() seems to have little effect on latency. But glFinish() on the other hand improves the latency noticeable. 

Best regards
Björn

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=63739#63739








More information about the osg-users mailing list