mirror of https://github.com/snes9xgit/snes9x.git
win32:opengl: Use DWM sync in windowed, Vsync in fullscreen exclusive.
This commit is contained in:
parent
045d20507d
commit
23a0e1251e
|
@ -384,6 +384,12 @@ bool COpenGL::ChangeRenderSize(unsigned int newWidth, unsigned int newHeight)
|
|||
return true;
|
||||
}
|
||||
|
||||
void COpenGL::SetSwapInterval(int frames)
|
||||
{
|
||||
if (wglSwapIntervalEXT)
|
||||
wglSwapIntervalEXT(frames);
|
||||
}
|
||||
|
||||
bool COpenGL::ApplyDisplayChanges(void)
|
||||
{
|
||||
if(wglSwapIntervalEXT) {
|
||||
|
|
|
@ -82,6 +82,7 @@ public:
|
|||
bool SetFullscreen(bool fullscreen);
|
||||
void SetSnes9xColorFormat(void);
|
||||
void EnumModes(std::vector<dMode> *modeVector);
|
||||
void SetSwapInterval(int frames);
|
||||
GLSLShader *GetActiveShader()
|
||||
{
|
||||
return glslShader;
|
||||
|
|
|
@ -287,16 +287,25 @@ bool8 S9xDeinitUpdate (int Width, int Height)
|
|||
LastHeight = Height;
|
||||
}
|
||||
|
||||
WinRefreshDisplay();
|
||||
|
||||
if (GUI.DWMSync)
|
||||
if (GUI.DWMSync && GUI.outputMethod == OPENGL)
|
||||
{
|
||||
BOOL DWMEnabled = false;
|
||||
|
||||
DwmIsCompositionEnabledProc(&DWMEnabled);
|
||||
if (DWMEnabled)
|
||||
|
||||
if (GUI.FullScreen || !DWMEnabled)
|
||||
((COpenGL *)S9xDisplayOutput)->SetSwapInterval(GUI.Vsync ? 1 : 0);
|
||||
else
|
||||
((COpenGL *)S9xDisplayOutput)->SetSwapInterval(0);
|
||||
|
||||
WinRefreshDisplay();
|
||||
|
||||
if (DWMEnabled && !GUI.FullScreen)
|
||||
DwmFlushProc();
|
||||
}
|
||||
else
|
||||
{
|
||||
WinRefreshDisplay();
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue