mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 06:15:38 +00:00
WindowInfo: Don't clear display when going surfaceless
Fixes panic when a popup occurs when using GLX.
This commit is contained in:
parent
add2b5fbae
commit
27b0847ee7
|
@ -2,6 +2,21 @@
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
Log_SetChannel(WindowInfo);
|
Log_SetChannel(WindowInfo);
|
||||||
|
|
||||||
|
void WindowInfo::SetSurfaceless()
|
||||||
|
{
|
||||||
|
type = Type::Surfaceless;
|
||||||
|
window_handle = nullptr;
|
||||||
|
surface_width = 0;
|
||||||
|
surface_height = 0;
|
||||||
|
surface_refresh_rate = 0.0f;
|
||||||
|
surface_scale = 1.0f;
|
||||||
|
surface_format = SurfaceFormat::None;
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
surface_handle = nullptr;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
#include "common/windows_headers.h"
|
#include "common/windows_headers.h"
|
||||||
|
|
|
@ -39,5 +39,8 @@ struct WindowInfo
|
||||||
void* surface_handle = nullptr;
|
void* surface_handle = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Changes the window to be surfaceless (i.e. no handle/size/etc).
|
||||||
|
void SetSurfaceless();
|
||||||
|
|
||||||
static bool QueryRefreshRateForWindow(const WindowInfo& wi, float* refresh_rate);
|
static bool QueryRefreshRateForWindow(const WindowInfo& wi, float* refresh_rate);
|
||||||
};
|
};
|
||||||
|
|
|
@ -459,6 +459,7 @@ bool D3D11HostDisplay::ChangeRenderWindow(const WindowInfo& new_wi)
|
||||||
|
|
||||||
void D3D11HostDisplay::DestroyRenderSurface()
|
void D3D11HostDisplay::DestroyRenderSurface()
|
||||||
{
|
{
|
||||||
|
m_window_info.SetSurfaceless();
|
||||||
if (IsFullscreen())
|
if (IsFullscreen())
|
||||||
SetFullscreen(false, 0, 0, 0.0f);
|
SetFullscreen(false, 0, 0, 0.0f);
|
||||||
|
|
||||||
|
|
|
@ -348,6 +348,8 @@ bool D3D12HostDisplay::ChangeRenderWindow(const WindowInfo& new_wi)
|
||||||
|
|
||||||
void D3D12HostDisplay::DestroyRenderSurface()
|
void D3D12HostDisplay::DestroyRenderSurface()
|
||||||
{
|
{
|
||||||
|
m_window_info.SetSurfaceless();
|
||||||
|
|
||||||
// For some reason if we don't execute the command list here, the swap chain is in use.. not sure where.
|
// For some reason if we don't execute the command list here, the swap chain is in use.. not sure where.
|
||||||
g_d3d12_context->ExecuteCommandList(true);
|
g_d3d12_context->ExecuteCommandList(true);
|
||||||
|
|
||||||
|
|
|
@ -408,7 +408,7 @@ void OpenGLHostDisplay::DestroyRenderSurface()
|
||||||
if (!m_gl_context)
|
if (!m_gl_context)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_window_info = {};
|
m_window_info.SetSurfaceless();
|
||||||
if (!m_gl_context->ChangeSurface(m_window_info))
|
if (!m_gl_context->ChangeSurface(m_window_info))
|
||||||
Log_ErrorPrintf("Failed to switch to surfaceless");
|
Log_ErrorPrintf("Failed to switch to surfaceless");
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ HostDisplay::AdapterAndModeList VulkanHostDisplay::GetAdapterAndModeList()
|
||||||
|
|
||||||
void VulkanHostDisplay::DestroyRenderSurface()
|
void VulkanHostDisplay::DestroyRenderSurface()
|
||||||
{
|
{
|
||||||
m_window_info = {};
|
m_window_info.SetSurfaceless();
|
||||||
g_vulkan_context->WaitForGPUIdle();
|
g_vulkan_context->WaitForGPUIdle();
|
||||||
m_swap_chain.reset();
|
m_swap_chain.reset();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue