mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-12 01:38:29 +12:00
Linux+OpenGL: Implement GUI vsync setting (#477)
This commit is contained in:
parent
2842615edb
commit
e9d10a9581
6 changed files with 391 additions and 19 deletions
|
@ -64,7 +64,31 @@ public:
|
|||
delete sGLContext;
|
||||
}
|
||||
|
||||
void UpdateVSyncState()
|
||||
{
|
||||
int configValue = GetConfig().vsync.GetValue();
|
||||
if(m_activeVSyncState != configValue)
|
||||
{
|
||||
#if BOOST_OS_WINDOWS
|
||||
if(wglSwapIntervalEXT)
|
||||
wglSwapIntervalEXT(configValue); // 1 = enabled, 0 = disabled
|
||||
#elif BOOST_OS_LINUX
|
||||
if (eglSwapInterval)
|
||||
{
|
||||
if (eglSwapInterval(eglGetCurrentDisplay(), configValue) == EGL_FALSE)
|
||||
{
|
||||
cemuLog_force("Failed to set vsync using EGL");
|
||||
}
|
||||
}
|
||||
#else
|
||||
cemuLog_log(LogType::Force, "OpenGL vsync not implemented");
|
||||
#endif
|
||||
m_activeVSyncState = configValue;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
int m_activeVSyncState = -1;
|
||||
//wxGLContext* m_context = nullptr;
|
||||
};
|
||||
|
||||
|
@ -93,11 +117,13 @@ void GLCanvas_SwapBuffers(bool swapTV, bool swapDRC)
|
|||
{
|
||||
GLCanvas_MakeCurrent(false);
|
||||
sGLTVView->SwapBuffers();
|
||||
sGLTVView->UpdateVSyncState();
|
||||
}
|
||||
if (swapDRC && sGLPadView)
|
||||
{
|
||||
GLCanvas_MakeCurrent(true);
|
||||
sGLPadView->SwapBuffers();
|
||||
sGLPadView->UpdateVSyncState();
|
||||
}
|
||||
|
||||
GLCanvas_MakeCurrent(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue