Use EXT_swap_control_tear when available to ensure that VSync never slows things down (tears instead if it can't keep up, better than stuttering)

This commit is contained in:
Henrik Rydgard committed 2013-07-07 11:25:18 +02:00
1 parent cee45d0ad2
commit 1256d5528d
2 files changed
+13 -2

No files matched your search

+12 -2
View File
@@ -171,7 +171,12 @@ static const u8 flushBeforeCommandList[] = {
GLES_GPU::GLES_GPU()
: resized_(false) {
lastVsync_ = g_Config.iVSyncInterval;
glstate.SetVSyncInterval(g_Config.iVSyncInterval);
if (gl_extensions.EXT_swap_control_tear) {
// See http://developer.download.nvidia.com/opengl/specs/WGL_EXT_swap_control_tear.txt
glstate.SetVSyncInterval(-g_Config.iVSyncInterval);
} else {
glstate.SetVSyncInterval(g_Config.iVSyncInterval);
}
shaderManager_ = new ShaderManager();
transformDraw_.SetShaderManager(shaderManager_);
@@ -255,7 +260,12 @@ void GLES_GPU::BeginFrame() {
if ((PSP_CoreParameter().unthrottle) || (PSP_CoreParameter().fpsLimit == 2) || (PSP_CoreParameter().fpsLimit == 1))
desiredVSyncInterval = 0;
if (desiredVSyncInterval != lastVsync_) {
glstate.SetVSyncInterval(desiredVSyncInterval);
if (gl_extensions.EXT_swap_control_tear) {
// See http://developer.download.nvidia.com/opengl/specs/WGL_EXT_swap_control_tear.txt
glstate.SetVSyncInterval(-desiredVSyncInterval);
} else {
glstate.SetVSyncInterval(desiredVSyncInterval);
}
lastVsync_ = desiredVSyncInterval;
}
+1
View File
@@ -196,6 +196,7 @@ bool GL_Init(HWND window, std::string *error_message) {
glGetIntegerv(GL_MINOR_VERSION, &OpenGLVersion[1]);
glstate.Initialize();
CheckGLExtensions();
GL_SetVSyncInterval(0);
if (enableGLDebug && glewIsSupported("GL_ARB_debug_output")) {
glDebugMessageCallbackARB((GLDEBUGPROCARB)&DebugCallbackARB, 0); // print debug output to stderr