From cd94ff19663ad1d0bb65395d8b822b56d3603863 Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Sat, 19 Jul 2014 20:18:03 +0200 Subject: [PATCH] VideoConfig: Add "Borderless Fullscreen" option. This option will disable exclusive fullscreen for users who prefer the old behaviour. --- Source/Core/DolphinWX/VideoConfigDiag.cpp | 6 ++++++ Source/Core/DolphinWX/VideoConfigDiag.h | 5 +++++ Source/Core/VideoBackends/D3D/Render.cpp | 3 ++- Source/Core/VideoBackends/D3D/main.cpp | 1 + Source/Core/VideoBackends/OGL/main.cpp | 1 + Source/Core/VideoCommon/VideoConfig.cpp | 4 ++++ Source/Core/VideoCommon/VideoConfig.h | 2 ++ 7 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Source/Core/DolphinWX/VideoConfigDiag.cpp b/Source/Core/DolphinWX/VideoConfigDiag.cpp index 00fab2bb6a..07c1f1e588 100644 --- a/Source/Core/DolphinWX/VideoConfigDiag.cpp +++ b/Source/Core/DolphinWX/VideoConfigDiag.cpp @@ -114,6 +114,7 @@ static wxString pixel_lighting_desc = wxTRANSLATE("Calculate lighting of 3D grap static wxString fast_depth_calc_desc = wxTRANSLATE("Use a less accurate algorithm to calculate depth values.\nCauses issues in a few games but might give a decent speedup.\n\nIf unsure, leave this checked."); static wxString force_filtering_desc = wxTRANSLATE("Force texture filtering even if the emulated game explicitly disabled it.\nImproves texture quality slightly but causes glitches in some games.\n\nIf unsure, leave this unchecked."); static wxString _3d_vision_desc = wxTRANSLATE("Enable 3D effects via stereoscopy using Nvidia 3D Vision technology if it's supported by your GPU.\nPossibly causes issues.\nRequires fullscreen to work.\n\nIf unsure, leave this unchecked."); +static wxString borderless_fullscreen_desc = wxTRANSLATE("Don't use exclusive mode when in fullscreen.\nAllows for faster transitions between fullscreen and windowed mode.\nIncreases input latency, makes movement less smooth and slightly decreases performance.\nExclusive mode is required to support 3D Vision.\n\nIf unsure, leave this unchecked."); static wxString internal_res_desc = wxTRANSLATE("Specifies the resolution used to render at. A high resolution will improve visual quality a lot but is also quite heavy on performance and might cause glitches in certain games.\n\"Multiple of 640x528\" is a bit slower than \"Window Size\" but yields less issues. Generally speaking, the lower the internal resolution is, the better your performance will be.\n\nIf unsure, select 640x528."); static wxString efb_access_desc = wxTRANSLATE("Ignore any requests of the CPU to read from or write to the EFB.\nImproves performance in some games, but might disable some gameplay-related features or graphical effects.\n\nIf unsure, leave this unchecked."); static wxString efb_emulate_format_changes_desc = wxTRANSLATE("Ignore any changes to the EFB format.\nImproves performance in many games without any negative effect. Causes graphical defects in a small number of other games though.\n\nIf unsure, leave this checked."); @@ -584,6 +585,11 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con szr_misc->Add(cb_prog_scan); } + // Borderless Fullscreen + borderless_fullscreen = CreateCheckBox(page_advanced, _("Borderless Fullscreen"), wxGetTranslation(borderless_fullscreen_desc), vconfig.bForceBorderlessFullscreen); + borderless_fullscreen->Show(vconfig.backend_info.bSupportsExclusiveFullscreen); + szr_misc->Add(borderless_fullscreen); + wxStaticBoxSizer* const group_misc = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Misc")); szr_advanced->Add(group_misc, 0, wxEXPAND | wxALL, 5); group_misc->Add(szr_misc, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); diff --git a/Source/Core/DolphinWX/VideoConfigDiag.h b/Source/Core/DolphinWX/VideoConfigDiag.h index c17506351b..2906729757 100644 --- a/Source/Core/DolphinWX/VideoConfigDiag.h +++ b/Source/Core/DolphinWX/VideoConfigDiag.h @@ -159,6 +159,10 @@ protected: _3d_vision->Enable(vconfig.backend_info.bSupports3DVision); _3d_vision->Show(vconfig.backend_info.bSupports3DVision); + // Borderless Fullscreen + borderless_fullscreen->Enable(vconfig.backend_info.bSupportsExclusiveFullscreen); + borderless_fullscreen->Show(vconfig.backend_info.bSupportsExclusiveFullscreen); + // EFB copy efbcopy_texture->Enable(vconfig.bEFBCopyEnable); efbcopy_ram->Enable(vconfig.bEFBCopyEnable); @@ -189,6 +193,7 @@ protected: SettingChoice* choice_aamode; SettingCheckBox* _3d_vision; + SettingCheckBox* borderless_fullscreen; SettingRadioButton* efbcopy_texture; SettingRadioButton* efbcopy_ram; diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index 183a4e16c3..a7b2c56212 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -938,7 +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 && !SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain; + const bool fullscreen = g_ActiveConfig.bFullscreen && !g_ActiveConfig.bForceBorderlessFullscreen && + !SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain; bool fullscreen_changed = s_last_fullscreen_mode != fullscreen; diff --git a/Source/Core/VideoBackends/D3D/main.cpp b/Source/Core/VideoBackends/D3D/main.cpp index be2173cdcf..504951e684 100644 --- a/Source/Core/VideoBackends/D3D/main.cpp +++ b/Source/Core/VideoBackends/D3D/main.cpp @@ -85,6 +85,7 @@ void InitBackendInfo() g_Config.backend_info.bUseRGBATextures = true; // the GX formats barely match any D3D11 formats g_Config.backend_info.bUseMinimalMipCount = true; g_Config.backend_info.bSupports3DVision = false; + g_Config.backend_info.bSupportsExclusiveFullscreen = true; g_Config.backend_info.bSupportsDualSourceBlend = true; g_Config.backend_info.bSupportsPrimitiveRestart = true; g_Config.backend_info.bSupportsOversizedViewports = false; diff --git a/Source/Core/VideoBackends/OGL/main.cpp b/Source/Core/VideoBackends/OGL/main.cpp index fb4079a9c8..0c7e90e097 100644 --- a/Source/Core/VideoBackends/OGL/main.cpp +++ b/Source/Core/VideoBackends/OGL/main.cpp @@ -144,6 +144,7 @@ static void InitBackendInfo() g_Config.backend_info.bUseRGBATextures = true; g_Config.backend_info.bUseMinimalMipCount = false; g_Config.backend_info.bSupports3DVision = false; + g_Config.backend_info.bSupportsExclusiveFullscreen = false; //g_Config.backend_info.bSupportsDualSourceBlend = true; // is gpu dependent and must be set in renderer //g_Config.backend_info.bSupportsEarlyZ = true; // is gpu dependent and must be set in renderer g_Config.backend_info.bSupportsOversizedViewports = true; diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index 1dc75e4ba2..d995ae2d4b 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -39,6 +39,7 @@ VideoConfig::VideoConfig() backend_info.bUseRGBATextures = false; backend_info.bUseMinimalMipCount = false; backend_info.bSupports3DVision = false; + backend_info.bSupportsExclusiveFullscreen = false; } void VideoConfig::Load(const std::string& ini_file) @@ -83,6 +84,7 @@ void VideoConfig::Load(const std::string& ini_file) settings->Get("DisableFog", &bDisableFog, 0); settings->Get("OMPDecoder", &bOMPDecoder, false); settings->Get("EnableShaderDebugging", &bEnableShaderDebugging, false); + settings->Get("ForceBorderlessFullscreen", &bForceBorderlessFullscreen, false); IniFile::Section* enhancements = iniFile.GetOrCreateSection("Enhancements"); enhancements->Get("ForceFiltering", &bForceFiltering, 0); @@ -211,6 +213,7 @@ void VideoConfig::VerifyValidity() if (iAdapter < 0 || iAdapter > ((int)backend_info.Adapters.size() - 1)) iAdapter = 0; if (iMultisampleMode < 0 || iMultisampleMode >= (int)backend_info.AAModes.size()) iMultisampleMode = 0; if (!backend_info.bSupports3DVision) b3DVision = false; + if (!backend_info.bSupportsExclusiveFullscreen) bForceBorderlessFullscreen = false; } void VideoConfig::Save(const std::string& ini_file) @@ -255,6 +258,7 @@ void VideoConfig::Save(const std::string& ini_file) settings->Set("DisableFog", bDisableFog); settings->Set("OMPDecoder", bOMPDecoder); settings->Set("EnableShaderDebugging", bEnableShaderDebugging); + settings->Set("ForceBorderlessFullscreen", bForceBorderlessFullscreen); IniFile::Section* enhancements = iniFile.GetOrCreateSection("Enhancements"); enhancements->Set("ForceFiltering", bForceFiltering); diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h index 8a7490497f..d2c5f1eaae 100644 --- a/Source/Core/VideoCommon/VideoConfig.h +++ b/Source/Core/VideoCommon/VideoConfig.h @@ -101,6 +101,7 @@ struct VideoConfig final int iAnaglyphStereoSeparation; int iAnaglyphFocalAngle; bool b3DVision; + bool bForceBorderlessFullscreen; // Hacks bool bEFBAccessEnable; @@ -140,6 +141,7 @@ struct VideoConfig final bool bUseRGBATextures; // used for D3D in TextureCache bool bUseMinimalMipCount; bool bSupports3DVision; + bool bSupportsExclusiveFullscreen; bool bSupportsDualSourceBlend; bool bSupportsPrimitiveRestart; bool bSupportsOversizedViewports;