D3D: Add exclusive fullscreen support.

This commit is contained in:
Jules Blok 2014-06-18 15:04:23 +02:00
parent d72375fdfa
commit 77bc879384
5 changed files with 14 additions and 2 deletions

View File

@ -1206,6 +1206,8 @@ void CFrame::DoFullscreen(bool bF)
{ {
m_RenderFrame->Raise(); m_RenderFrame->Raise();
} }
g_Config.bFullscreen = bF;
} }
const CGameListCtrl *CFrame::GetGameListCtrl() const const CGameListCtrl *CFrame::GetGameListCtrl() const

View File

@ -431,6 +431,9 @@ void Reset()
// release all back buffer references // release all back buffer references
SAFE_RELEASE(backbuf); SAFE_RELEASE(backbuf);
// apply fullscreen state
D3D::swapchain->SetFullscreenState(g_ActiveConfig.bFullscreen, nullptr);
// resize swapchain buffers // resize swapchain buffers
RECT client; RECT client;
GetClientRect(hWnd, &client); GetClientRect(hWnd, &client);

View File

@ -42,6 +42,8 @@ static u32 s_LastAA = 0;
static Television s_television; static Television s_television;
static bool s_LastFS = false;
ID3D11Buffer* access_efb_cbuf = nullptr; ID3D11Buffer* access_efb_cbuf = nullptr;
ID3D11BlendState* clearblendstates[4] = {nullptr}; ID3D11BlendState* clearblendstates[4] = {nullptr};
ID3D11DepthStencilState* cleardepthstates[3] = {nullptr}; ID3D11DepthStencilState* cleardepthstates[3] = {nullptr};
@ -936,6 +938,8 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl
SetWindowSize(fbWidth, fbHeight); SetWindowSize(fbWidth, fbHeight);
const bool windowResized = CheckForResize(); const bool windowResized = CheckForResize();
const bool fullscreen = g_ActiveConfig.bFullscreen;
const bool fsChanged = s_LastFS != fullscreen;
bool xfbchanged = false; 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 // resize the back buffers NOW to avoid flickering
if (xfbchanged || if (xfbchanged ||
windowResized || windowResized ||
fsChanged ||
s_LastEFBScale != g_ActiveConfig.iEFBScale || s_LastEFBScale != g_ActiveConfig.iEFBScale ||
s_LastAA != g_ActiveConfig.iMultisampleMode) s_LastAA != g_ActiveConfig.iMultisampleMode)
{ {
s_LastAA = g_ActiveConfig.iMultisampleMode; s_LastAA = g_ActiveConfig.iMultisampleMode;
s_LastFS = g_ActiveConfig.bFullscreen;
PixelShaderCache::InvalidateMSAAShaders(); PixelShaderCache::InvalidateMSAAShaders();
if (windowResized) if (windowResized || fsChanged)
{ {
// TODO: Aren't we still holding a reference to the back buffer right now? // TODO: Aren't we still holding a reference to the back buffer right now?
D3D::Reset(); D3D::Reset();

View File

@ -28,6 +28,7 @@ void UpdateActiveConfig()
VideoConfig::VideoConfig() VideoConfig::VideoConfig()
{ {
bRunning = false; bRunning = false;
bFullscreen = false;
// Needed for the first frame, I think // Needed for the first frame, I think
fAspectRatioHackW = 1; fAspectRatioHackW = 1;

View File

@ -57,7 +57,7 @@ struct VideoConfig final
// General // General
bool bVSync; bool bVSync;
bool bFullscreen;
bool bRunning; bool bRunning;
bool bWidescreenHack; bool bWidescreenHack;
int iAspectRatio; int iAspectRatio;