GeneralSettings: Update vsync after settings close (#401)

This commit is contained in:
goeiecool9999 2022-10-31 17:54:26 +01:00 committed by GitHub
parent f41f7b63e8
commit c3182aedd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 29 deletions

View file

@ -352,14 +352,19 @@ void OpenGLRenderer::NotifyLatteCommandProcessorIdle()
glFlush();
}
void OpenGLRenderer::EnableVSync(int state)
void OpenGLRenderer::UpdateVSyncState()
{
int configValue = GetConfig().vsync.GetValue();
if(m_activeVSyncState != configValue)
{
#if BOOST_OS_WINDOWS
if(wglSwapIntervalEXT)
wglSwapIntervalEXT(state); // 1 = enabled, 0 = disabled
if(wglSwapIntervalEXT)
wglSwapIntervalEXT(configValue); // 1 = enabled, 0 = disabled
#else
cemuLog_log(LogType::Force, "OpenGL vsync not implemented");
cemuLog_log(LogType::Force, "OpenGL vsync not implemented");
#endif
m_activeVSyncState = configValue;
}
}
bool IsRunningInWine();
@ -438,6 +443,7 @@ void OpenGLRenderer::EnableDebugMode()
void OpenGLRenderer::SwapBuffers(bool swapTV, bool swapDRC)
{
GLCanvas_SwapBuffers(swapTV, swapDRC);
UpdateVSyncState();
if (swapTV)
cleanupAfterFrame();