D3DBase: Create the swapchain in fullscreen mode if enabled.
This commit is contained in:
parent
0028ee96b3
commit
9909babe2c
|
@ -8,6 +8,7 @@
|
|||
#include "Common/Logging/Log.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "VideoBackends/D3D/D3DBase.h"
|
||||
#include "VideoBackends/D3D/D3DState.h"
|
||||
#include "VideoBackends/D3D/D3DTexture.h"
|
||||
|
@ -315,7 +316,8 @@ HRESULT Create(HWND wnd)
|
|||
swap_chain_desc.OutputWindow = wnd;
|
||||
swap_chain_desc.SampleDesc.Count = 1;
|
||||
swap_chain_desc.SampleDesc.Quality = 0;
|
||||
swap_chain_desc.Windowed = TRUE;
|
||||
swap_chain_desc.Windowed =
|
||||
!SConfig::GetInstance().bFullscreen || g_ActiveConfig.bBorderlessFullscreen;
|
||||
|
||||
DXGI_OUTPUT_DESC out_desc = {};
|
||||
output->GetDesc(&out_desc);
|
||||
|
@ -610,17 +612,11 @@ HRESULT SetFullscreenState(bool enable_fullscreen)
|
|||
return swapchain->SetFullscreenState(enable_fullscreen, nullptr);
|
||||
}
|
||||
|
||||
HRESULT GetFullscreenState(bool* fullscreen_state)
|
||||
bool GetFullscreenState()
|
||||
{
|
||||
if (fullscreen_state == nullptr)
|
||||
{
|
||||
return E_POINTER;
|
||||
}
|
||||
|
||||
BOOL state;
|
||||
HRESULT hr = swapchain->GetFullscreenState(&state, nullptr);
|
||||
*fullscreen_state = !!state;
|
||||
return hr;
|
||||
BOOL state = FALSE;
|
||||
swapchain->GetFullscreenState(&state, nullptr);
|
||||
return !!state;
|
||||
}
|
||||
|
||||
} // namespace D3D
|
||||
|
|
|
@ -75,7 +75,7 @@ bool BGRATexturesSupported();
|
|||
unsigned int GetMaxTextureSize();
|
||||
|
||||
HRESULT SetFullscreenState(bool enable_fullscreen);
|
||||
HRESULT GetFullscreenState(bool* fullscreen_state);
|
||||
bool GetFullscreenState();
|
||||
|
||||
// This function will assign a name to the given resource.
|
||||
// The DirectX debug layer will make it easier to identify resources that way,
|
||||
|
|
|
@ -254,6 +254,7 @@ Renderer::Renderer(void*& window_handle)
|
|||
s_last_efb_scale = g_ActiveConfig.iEFBScale;
|
||||
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
|
||||
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
|
||||
s_last_exclusive_mode = D3D::GetFullscreenState();
|
||||
CalculateTargetSize(s_backbuffer_width, s_backbuffer_height);
|
||||
PixelShaderManager::SetEfbScaleChanged();
|
||||
|
||||
|
@ -875,8 +876,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
|
|||
{
|
||||
std::lock_guard<std::mutex> lk(s_critical_fullscreen);
|
||||
|
||||
bool exclusive_mode = false;
|
||||
D3D::GetFullscreenState(&exclusive_mode);
|
||||
const bool exclusive_mode = D3D::GetFullscreenState();
|
||||
if (s_last_exclusive_mode && !exclusive_mode && Host_RendererHasFocus())
|
||||
D3D::SetFullscreenState(true);
|
||||
}
|
||||
|
|
|
@ -871,12 +871,11 @@ HRESULT SetFullscreenState(bool enable_fullscreen)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT GetFullscreenState(bool* fullscreen_state)
|
||||
bool GetFullscreenState()
|
||||
{
|
||||
// Fullscreen exclusive intentionally not supported in DX12 backend. No performance
|
||||
// difference between it and windowed full-screen due to usage of a FLIP swap chain.
|
||||
*fullscreen_state = false;
|
||||
return S_OK;
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace D3D
|
||||
|
|
|
@ -124,7 +124,7 @@ const std::string VertexShaderVersionString();
|
|||
unsigned int GetMaxTextureSize();
|
||||
|
||||
HRESULT SetFullscreenState(bool enable_fullscreen);
|
||||
HRESULT GetFullscreenState(bool* fullscreen_state);
|
||||
bool GetFullscreenState();
|
||||
|
||||
// This function will assign a name to the given resource.
|
||||
// The DirectX debug layer will make it easier to identify resources that way,
|
||||
|
|
Loading…
Reference in New Issue