From 77bc87938412d8037439607a0c5047abece62452 Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Wed, 18 Jun 2014 15:04:23 +0200 Subject: [PATCH] D3D: Add exclusive fullscreen support. --- Source/Core/DolphinWX/Frame.cpp | 2 ++ Source/Core/VideoBackends/D3D/D3DBase.cpp | 3 +++ Source/Core/VideoBackends/D3D/Render.cpp | 8 +++++++- Source/Core/VideoCommon/VideoConfig.cpp | 1 + Source/Core/VideoCommon/VideoConfig.h | 2 +- 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp index 763909e26b..4c258d5453 100644 --- a/Source/Core/DolphinWX/Frame.cpp +++ b/Source/Core/DolphinWX/Frame.cpp @@ -1206,6 +1206,8 @@ void CFrame::DoFullscreen(bool bF) { m_RenderFrame->Raise(); } + + g_Config.bFullscreen = bF; } const CGameListCtrl *CFrame::GetGameListCtrl() const diff --git a/Source/Core/VideoBackends/D3D/D3DBase.cpp b/Source/Core/VideoBackends/D3D/D3DBase.cpp index d2d2cb3996..a0ec02bf30 100644 --- a/Source/Core/VideoBackends/D3D/D3DBase.cpp +++ b/Source/Core/VideoBackends/D3D/D3DBase.cpp @@ -431,6 +431,9 @@ void Reset() // release all back buffer references SAFE_RELEASE(backbuf); + // apply fullscreen state + D3D::swapchain->SetFullscreenState(g_ActiveConfig.bFullscreen, nullptr); + // resize swapchain buffers RECT client; GetClientRect(hWnd, &client); diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index 2699b56a46..8741900261 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -42,6 +42,8 @@ static u32 s_LastAA = 0; static Television s_television; +static bool s_LastFS = false; + ID3D11Buffer* access_efb_cbuf = nullptr; ID3D11BlendState* clearblendstates[4] = {nullptr}; ID3D11DepthStencilState* cleardepthstates[3] = {nullptr}; @@ -936,6 +938,8 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl SetWindowSize(fbWidth, fbHeight); const bool windowResized = CheckForResize(); + const bool fullscreen = g_ActiveConfig.bFullscreen; + const bool fsChanged = s_LastFS != fullscreen; bool xfbchanged = false; @@ -954,13 +958,15 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl // resize the back buffers NOW to avoid flickering if (xfbchanged || windowResized || + fsChanged || s_LastEFBScale != g_ActiveConfig.iEFBScale || s_LastAA != g_ActiveConfig.iMultisampleMode) { s_LastAA = g_ActiveConfig.iMultisampleMode; + s_LastFS = g_ActiveConfig.bFullscreen; PixelShaderCache::InvalidateMSAAShaders(); - if (windowResized) + if (windowResized || fsChanged) { // TODO: Aren't we still holding a reference to the back buffer right now? D3D::Reset(); diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index 77e4eb819c..1dc75e4ba2 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -28,6 +28,7 @@ void UpdateActiveConfig() VideoConfig::VideoConfig() { bRunning = false; + bFullscreen = false; // Needed for the first frame, I think fAspectRatioHackW = 1; diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h index 595ded24ec..8a7490497f 100644 --- a/Source/Core/VideoCommon/VideoConfig.h +++ b/Source/Core/VideoCommon/VideoConfig.h @@ -57,7 +57,7 @@ struct VideoConfig final // General bool bVSync; - + bool bFullscreen; bool bRunning; bool bWidescreenHack; int iAspectRatio;