From d00e76b3efc83b4e55f5eb35910d82d4cdec824b Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Wed, 16 Jul 2014 22:13:13 +0200 Subject: [PATCH] Cosmetic changes based on feedback on PR #506. --- Source/Core/VideoBackends/D3D/D3DBase.cpp | 3 +++ Source/Core/VideoBackends/D3D/Render.cpp | 21 ++++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Source/Core/VideoBackends/D3D/D3DBase.cpp b/Source/Core/VideoBackends/D3D/D3DBase.cpp index 945ba19359..718ed9eec8 100644 --- a/Source/Core/VideoBackends/D3D/D3DBase.cpp +++ b/Source/Core/VideoBackends/D3D/D3DBase.cpp @@ -314,6 +314,9 @@ HRESULT Create(HWND wnd) return E_FAIL; } + // prevent DXGI from responding to Alt+Enter, unfortunately DXGI_MWA_NO_ALT_ENTER + // does not work so we disable all monitoring of window messages. However this + // may make it more difficult for DXGI to handle display mode changes. hr = factory->MakeWindowAssociation(wnd, DXGI_MWA_NO_WINDOW_CHANGES); if (FAILED(hr)) MessageBox(wnd, _T("Failed to associate the window"), _T("Dolphin Direct3D 11 backend"), MB_OK | MB_ICONERROR); diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index 40b431871b..8311310fb1 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -42,7 +42,7 @@ static u32 s_LastAA = 0; static Television s_television; -static bool s_LastFS = false; +static bool s_last_fullscreen_mode = false; ID3D11Buffer* access_efb_cbuf = nullptr; ID3D11BlendState* clearblendstates[4] = {nullptr}; @@ -940,13 +940,16 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl const bool windowResized = CheckForResize(); const bool fullscreen = g_ActiveConfig.bFullscreen; - bool fsChanged = s_LastFS != fullscreen; + bool fullscreen_changed = s_last_fullscreen_mode != fullscreen; - BOOL fsState; - if (SUCCEEDED(D3D::swapchain->GetFullscreenState(&fsState, nullptr)) && !!fsState != fullscreen) + BOOL fullscreen_state; + if (SUCCEEDED(D3D::swapchain->GetFullscreenState(&fullscreen_state, nullptr))) { - // We should be in fullscreen, but we're not. Restore it when we regain focus. - fsChanged = Host_RendererHasFocus(); + if (!!fullscreen_state != fullscreen) + { + // We should be in fullscreen, but we're not. Restore it when we regain focus. + fullscreen_changed = Host_RendererHasFocus(); + } } bool xfbchanged = false; @@ -966,15 +969,15 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl // resize the back buffers NOW to avoid flickering if (xfbchanged || windowResized || - fsChanged || + fullscreen_changed || s_LastEFBScale != g_ActiveConfig.iEFBScale || s_LastAA != g_ActiveConfig.iMultisampleMode) { s_LastAA = g_ActiveConfig.iMultisampleMode; - s_LastFS = g_ActiveConfig.bFullscreen; + s_last_fullscreen_mode = fullscreen; PixelShaderCache::InvalidateMSAAShaders(); - if (windowResized || fsChanged) + if (windowResized || fullscreen_changed) { // TODO: Aren't we still holding a reference to the back buffer right now? D3D::Reset();