GS: Fix hang when switching renderer while fullscreen

This commit is contained in:
Stenzek 2023-04-27 16:06:25 +10:00 committed by refractionpcsx2
parent d8239664a8
commit 0c389789f3
8 changed files with 1 additions and 21 deletions

View File

@ -359,6 +359,7 @@ void GSclose()
{
CloseGSRenderer();
CloseGSDevice(true);
Host::ReleaseRenderWindow();
}
void GSreset(bool hardware_reset)

View File

@ -216,12 +216,6 @@ bool GSDevice::AcquireWindow(bool recreate_window)
return true;
}
void GSDevice::ReleaseWindow()
{
Host::ReleaseRenderWindow();
m_window_info = WindowInfo();
}
bool GSDevice::GetHostRefreshRate(float* refresh_rate)
{
if (m_window_info.surface_refresh_rate > 0.0f)

View File

@ -780,7 +780,6 @@ protected:
FeatureSupport m_features;
bool AcquireWindow(bool recreate_window);
void ReleaseWindow();
virtual GSTexture* CreateSurface(GSTexture::Type type, int width, int height, int levels, GSTexture::Format format) = 0;
GSTexture* FetchSurface(GSTexture::Type type, int width, int height, int levels, GSTexture::Format format, bool clear, bool prefer_reuse);

View File

@ -493,7 +493,6 @@ void GSDevice11::Destroy()
{
GSDevice::Destroy();
DestroySwapChain();
ReleaseWindow();
DestroyTimestampQueries();
m_convert = {};
@ -769,7 +768,6 @@ bool GSDevice11::UpdateWindow()
if (m_window_info.type != WindowInfo::Type::Surfaceless && !CreateSwapChain())
{
Console.WriteLn("Failed to create swap chain on updated window");
ReleaseWindow();
return false;
}

View File

@ -218,7 +218,6 @@ void GSDevice12::Destroy()
ExecuteCommandList(true);
DestroyResources();
DestroySwapChain();
ReleaseWindow();
g_d3d12_context->Destroy();
}
}
@ -432,7 +431,6 @@ bool GSDevice12::UpdateWindow()
if (m_window_info.type != WindowInfo::Type::Surfaceless && !CreateSwapChain())
{
Console.WriteLn("Failed to create swap chain on updated window");
ReleaseWindow();
return false;
}

View File

@ -1170,7 +1170,6 @@ void GSDeviceMTL::Destroy()
GSDevice::Destroy();
GSDeviceMTL::DestroySurface();
ReleaseWindow();
m_queue = nullptr;
m_dev.Reset();
}}

View File

@ -551,8 +551,6 @@ void GSDeviceOGL::Destroy()
m_gl_context->DoneCurrent();
m_gl_context.reset();
ReleaseWindow();
}
}
@ -673,7 +671,6 @@ bool GSDeviceOGL::UpdateWindow()
if (!m_gl_context->ChangeSurface(m_window_info))
{
Console.Error("Failed to change surface");
ReleaseWindow();
return false;
}

View File

@ -257,7 +257,6 @@ void GSDeviceVK::Destroy()
g_vulkan_context->WaitForGPUIdle();
m_swap_chain.reset();
ReleaseWindow();
Vulkan::ShaderCache::Destroy();
Vulkan::Context::Destroy();
@ -295,7 +294,6 @@ bool GSDeviceVK::UpdateWindow()
if (surface == VK_NULL_HANDLE)
{
Console.Error("Failed to create new surface for swap chain");
ReleaseWindow();
return false;
}
@ -304,7 +302,6 @@ bool GSDeviceVK::UpdateWindow()
{
Console.Error("Failed to create swap chain");
Vulkan::SwapChain::DestroyVulkanSurface(g_vulkan_context->GetVulkanInstance(), &m_window_info, surface);
ReleaseWindow();
return false;
}
@ -572,8 +569,6 @@ bool GSDeviceVK::CreateDeviceAndSwapChain()
if (!AcquireWindow(true))
return false;
ScopedGuard window_cleanup = [this]() { ReleaseWindow(); };
VkInstance instance =
Vulkan::Context::CreateVulkanInstance(m_window_info, enable_debug_utils, enable_validation_layer);
if (instance == VK_NULL_HANDLE)
@ -668,7 +663,6 @@ bool GSDeviceVK::CreateDeviceAndSwapChain()
surface_cleanup.Cancel();
instance_cleanup.Cancel();
window_cleanup.Cancel();
library_cleanup.Cancel();
// Render a frame as soon as possible to clear out whatever was previously being displayed.