1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[d3d9] Handle invalid modes in Device::Reset

This commit is contained in:
Georg Lehmann 2021-07-24 23:47:17 +02:00 committed by Joshie
parent 64c4eea922
commit 6071e998fd
3 changed files with 16 additions and 8 deletions

View File

@ -7079,8 +7079,10 @@ namespace dxvk {
}
}
if (m_implicitSwapchain != nullptr)
m_implicitSwapchain->Reset(pPresentationParameters, pFullscreenDisplayMode);
if (m_implicitSwapchain != nullptr) {
if (FAILED(m_implicitSwapchain->Reset(pPresentationParameters, pFullscreenDisplayMode)))
return D3DERR_INVALIDCALL;
}
else
m_implicitSwapchain = new D3D9SwapChainEx(this, pPresentationParameters, pFullscreenDisplayMode);

View File

@ -594,7 +594,7 @@ namespace dxvk {
}
void D3D9SwapChainEx::Reset(
HRESULT D3D9SwapChainEx::Reset(
D3DPRESENT_PARAMETERS* pPresentParams,
D3DDISPLAYMODEEX* pFullscreenDisplayMode) {
D3D9DeviceLock lock = m_parent->LockDevice();
@ -627,13 +627,17 @@ namespace dxvk {
newRect.right - newRect.left, newRect.bottom - newRect.top, TRUE);
}
else {
if (changeFullscreen)
this->EnterFullscreenMode(pPresentParams, pFullscreenDisplayMode);
if (changeFullscreen) {
if (FAILED(this->EnterFullscreenMode(pPresentParams, pFullscreenDisplayMode)))
return D3DERR_INVALIDCALL;
}
D3D9WindowMessageFilter filter(m_window);
if (!changeFullscreen)
ChangeDisplayMode(pPresentParams, pFullscreenDisplayMode);
if (!changeFullscreen) {
if (FAILED(ChangeDisplayMode(pPresentParams, pFullscreenDisplayMode)))
return D3DERR_INVALIDCALL;
}
// Move the window so that it covers the entire output
RECT rect;
@ -650,6 +654,8 @@ namespace dxvk {
SetGammaRamp(0, &m_ramp);
CreateBackBuffers(m_presentParams.BackBufferCount);
return D3D_OK;
}

View File

@ -56,7 +56,7 @@ namespace dxvk {
HRESULT STDMETHODCALLTYPE GetDisplayModeEx(D3DDISPLAYMODEEX* pMode, D3DDISPLAYROTATION* pRotation);
void Reset(
HRESULT Reset(
D3DPRESENT_PARAMETERS* pPresentParams,
D3DDISPLAYMODEEX* pFullscreenDisplayMode);