mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 16:19:28 +01:00
D3D: Make the global swapchain static again.
This commit is contained in:
parent
6724ce6275
commit
06b13f12d3
@ -31,7 +31,7 @@ namespace D3D
|
|||||||
|
|
||||||
ID3D11Device* device = nullptr;
|
ID3D11Device* device = nullptr;
|
||||||
ID3D11DeviceContext* context = nullptr;
|
ID3D11DeviceContext* context = nullptr;
|
||||||
IDXGISwapChain* swapchain = nullptr;
|
static IDXGISwapChain* swapchain = nullptr;
|
||||||
D3D_FEATURE_LEVEL featlevel;
|
D3D_FEATURE_LEVEL featlevel;
|
||||||
D3DTexture2D* backbuf = nullptr;
|
D3DTexture2D* backbuf = nullptr;
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
@ -492,6 +492,24 @@ void Present()
|
|||||||
swapchain->Present((UINT)g_ActiveConfig.IsVSync(), 0);
|
swapchain->Present((UINT)g_ActiveConfig.IsVSync(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT SetFullscreenState(bool enable_fullscreen)
|
||||||
|
{
|
||||||
|
return swapchain->SetFullscreenState(enable_fullscreen, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT GetFullscreenState(bool* fullscreen_state)
|
||||||
|
{
|
||||||
|
if (fullscreen_state == nullptr)
|
||||||
|
{
|
||||||
|
return E_POINTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL state;
|
||||||
|
HRESULT hr = swapchain->GetFullscreenState(&state, nullptr);
|
||||||
|
*fullscreen_state = !!state;
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace D3D
|
} // namespace D3D
|
||||||
|
|
||||||
} // namespace DX11
|
} // namespace DX11
|
||||||
|
@ -40,7 +40,6 @@ void Close();
|
|||||||
|
|
||||||
extern ID3D11Device* device;
|
extern ID3D11Device* device;
|
||||||
extern ID3D11DeviceContext* context;
|
extern ID3D11DeviceContext* context;
|
||||||
extern IDXGISwapChain* swapchain;
|
|
||||||
extern HWND hWnd;
|
extern HWND hWnd;
|
||||||
extern bool bFrameInProgress;
|
extern bool bFrameInProgress;
|
||||||
|
|
||||||
@ -59,6 +58,9 @@ bool BGRATexturesSupported();
|
|||||||
|
|
||||||
unsigned int GetMaxTextureSize();
|
unsigned int GetMaxTextureSize();
|
||||||
|
|
||||||
|
HRESULT SetFullscreenState(bool enable_fullscreen);
|
||||||
|
HRESULT GetFullscreenState(bool* fullscreen_state);
|
||||||
|
|
||||||
// Ihis function will assign a name to the given resource.
|
// Ihis function will assign a name to the given resource.
|
||||||
// The DirectX debug layer will make it easier to identify resources that way,
|
// The DirectX debug layer will make it easier to identify resources that way,
|
||||||
// e.g. when listing up all resources who have unreleased references.
|
// e.g. when listing up all resources who have unreleased references.
|
||||||
|
@ -943,10 +943,10 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl
|
|||||||
|
|
||||||
bool fullscreen_changed = s_last_fullscreen_mode != fullscreen;
|
bool fullscreen_changed = s_last_fullscreen_mode != fullscreen;
|
||||||
|
|
||||||
BOOL fullscreen_state;
|
bool fullscreen_state;
|
||||||
if (SUCCEEDED(D3D::swapchain->GetFullscreenState(&fullscreen_state, nullptr)))
|
if (SUCCEEDED(D3D::GetFullscreenState(&fullscreen_state)))
|
||||||
{
|
{
|
||||||
if (!!fullscreen_state != fullscreen && Host_RendererHasFocus())
|
if (fullscreen_state != fullscreen && Host_RendererHasFocus())
|
||||||
{
|
{
|
||||||
// The current fullscreen state does not match the configuration,
|
// The current fullscreen state does not match the configuration,
|
||||||
// this may happen when the renderer frame loses focus. When the
|
// this may happen when the renderer frame loses focus. When the
|
||||||
@ -985,7 +985,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl
|
|||||||
if (fullscreen_changed)
|
if (fullscreen_changed)
|
||||||
{
|
{
|
||||||
s_last_fullscreen_mode = fullscreen;
|
s_last_fullscreen_mode = fullscreen;
|
||||||
D3D::swapchain->SetFullscreenState(fullscreen, nullptr);
|
D3D::SetFullscreenState(fullscreen);
|
||||||
|
|
||||||
// Notify the host that it is safe to exit fullscreen
|
// Notify the host that it is safe to exit fullscreen
|
||||||
if (!fullscreen)
|
if (!fullscreen)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user