SDL2 and TripleBuffering |
SDL2 and TripleBuffering |
Nikos Chantziaras
Guest
|
On 13/11/15 12:50, mediata wrote:
AFAIK, SDL does not allow you to explicitly set triple buffering. You can only set the SDL_GL_DOUBLEBUFFER GL attribute. If you configured your driver to use triple buffering, then this *should* mean triple buffering will be used for all GL apps. Hopefully someone who knows more about this can provide more information about the issue. Note though, that triple buffering on its own doesn't do anything. It needs VSync. Without VSync, it does nothing (or at least, nothing useful.) Triple buffering does *not* eliminate tearing ("horizontal lines"). Only VSync does that. TB works together with VSync to avoid blocking your render loop while waiting for the next vblank. The result of that is that if your framerate isn't high enough, it gets halved. Without vsync, there's no wait for vblank, and thus the problem doesn't exist, so TB does nothing in that case. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Re: SDL2 and TripleBuffering |
mediata
|
From what i read here. http://www.anandtech.com/show/2794/2 . TripleBuffering is different from what you describe. While one buffer is presenting to monitor you can draw into other two. And when you finish with front buffer you can switch with ready one. And you can draw Or am wrong |
|||||||||||||||
|
SDL2 and TripleBuffering |
Eirik Byrkjeflot Anonsen
Guest
|
mediata writes:
Both Nikos and anandtech is right. Without vsync, you are always "finished with" the front buffer. So as soon as there is a "ready" buffer it will be swapped with the front buffer immediately. Since this can happen in the middle of sending the frame to the monitor, you will get tearing. It is only with vsync that there is any waiting before the front buffer is swapped with the "ready" buffer. In this case, the buffer is only swapped between two frames are sent to the monitor. Thus all frames are sent completely from a single frame buffer, and you will have no tearing (regardless of whether you are using double buffering or triple buffering). Thus, with triple buffering enabled and vsync disabled, you will always have 1 front buffer and 2 "not-ready" back buffers. With both triple buffering and vsync enabled, you may have 1 front buffer that will be displayed until the next vsync, 1 "ready" buffer that will become the front buffer on the next vsync and 1 "not-ready" buffer that you can render into. eirik _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||||
|