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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void COpenGL::SetSwapInterval(int frames)
|
||||||
|
{
|
||||||
|
if (wglSwapIntervalEXT)
|
||||||
|
wglSwapIntervalEXT(frames);
|
||||||
|
}
|
||||||
|
|
||||||
bool COpenGL::ApplyDisplayChanges(void)
|
bool COpenGL::ApplyDisplayChanges(void)
|
||||||
{
|
{
|
||||||
if(wglSwapIntervalEXT) {
|
if(wglSwapIntervalEXT) {
|
||||||
|
|
|
@ -81,7 +81,8 @@ public:
|
||||||
bool ApplyDisplayChanges(void);
|
bool ApplyDisplayChanges(void);
|
||||||
bool SetFullscreen(bool fullscreen);
|
bool SetFullscreen(bool fullscreen);
|
||||||
void SetSnes9xColorFormat(void);
|
void SetSnes9xColorFormat(void);
|
||||||
void EnumModes(std::vector<dMode> *modeVector);
|
void EnumModes(std::vector<dMode> *modeVector);
|
||||||
|
void SetSwapInterval(int frames);
|
||||||
GLSLShader *GetActiveShader()
|
GLSLShader *GetActiveShader()
|
||||||
{
|
{
|
||||||
return glslShader;
|
return glslShader;
|
||||||
|
|
|
@ -286,17 +286,26 @@ bool8 S9xDeinitUpdate (int Width, int Height)
|
||||||
LastWidth = Width;
|
LastWidth = Width;
|
||||||
LastHeight = Height;
|
LastHeight = Height;
|
||||||
}
|
}
|
||||||
|
|
||||||
WinRefreshDisplay();
|
|
||||||
|
|
||||||
if (GUI.DWMSync)
|
if (GUI.DWMSync && GUI.outputMethod == OPENGL)
|
||||||
{
|
{
|
||||||
BOOL DWMEnabled = false;
|
BOOL DWMEnabled = false;
|
||||||
|
|
||||||
DwmIsCompositionEnabledProc(&DWMEnabled);
|
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();
|
DwmFlushProc();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WinRefreshDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue