GSdx-D3D11: Avoid undefined behavior in swapchain

PCSX2 sends a negative value (-1) to GSdx when adaptive mode is
specified for Vsync, this mode is exclusive to OpenGL at the moment
and is unimplemented on the D3D11 renderer. Also the present function
of swapchain only accepts values from 0 to 4 as parameter, hence
passing negative values to the function is undefined behavior.

So let's fallback to standard synchronization method on D3D11 when
PCSX2 requests for adaptive mode.
This commit is contained in:
Akash 2017-08-24 00:25:42 +05:30 committed by Jonathan Li
parent 420f111611
commit 8fe8cad8f9
2 changed files with 6 additions and 0 deletions

View File

@ -432,6 +432,11 @@ void GSDevice11::SetExclusive(bool isExcl)
}
}
void GSDevice11::SetVSync(int vsync)
{
m_vsync = vsync ? 1 : 0;
}
void GSDevice11::Flip()
{
m_swapchain->Present(m_vsync, 0);

View File

@ -170,6 +170,7 @@ public:
bool Create(const std::shared_ptr<GSWnd> &wnd);
bool Reset(int w, int h);
void Flip();
void SetVSync(int vsync) final;
void SetExclusive(bool isExcl);