mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 13:57:57 -07:00
Merge pull request #6100 from leoetlino/vulkan-shutdown
Vulkan: Fix crash when Core initialisation fails
This commit is contained in:
commit
8163fa1acc
@ -194,9 +194,7 @@ bool VideoBackend::Initialize(void* window_handle)
|
|||||||
if (!swap_chain)
|
if (!swap_chain)
|
||||||
{
|
{
|
||||||
PanicAlert("Failed to create Vulkan swap chain.");
|
PanicAlert("Failed to create Vulkan swap chain.");
|
||||||
g_vulkan_context.reset();
|
Shutdown();
|
||||||
ShutdownShared();
|
|
||||||
UnloadVulkanLibrary();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -206,10 +204,7 @@ bool VideoBackend::Initialize(void* window_handle)
|
|||||||
if (!g_command_buffer_mgr->Initialize())
|
if (!g_command_buffer_mgr->Initialize())
|
||||||
{
|
{
|
||||||
PanicAlert("Failed to create Vulkan command buffers");
|
PanicAlert("Failed to create Vulkan command buffers");
|
||||||
g_command_buffer_mgr.reset();
|
Shutdown();
|
||||||
g_vulkan_context.reset();
|
|
||||||
ShutdownShared();
|
|
||||||
UnloadVulkanLibrary();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,15 +222,7 @@ bool VideoBackend::Initialize(void* window_handle)
|
|||||||
!Renderer::GetInstance()->Initialize())
|
!Renderer::GetInstance()->Initialize())
|
||||||
{
|
{
|
||||||
PanicAlert("Failed to initialize Vulkan classes.");
|
PanicAlert("Failed to initialize Vulkan classes.");
|
||||||
g_renderer.reset();
|
Shutdown();
|
||||||
StateTracker::DestroyInstance();
|
|
||||||
g_framebuffer_manager.reset();
|
|
||||||
g_shader_cache.reset();
|
|
||||||
g_object_cache.reset();
|
|
||||||
g_command_buffer_mgr.reset();
|
|
||||||
g_vulkan_context.reset();
|
|
||||||
ShutdownShared();
|
|
||||||
UnloadVulkanLibrary();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,19 +234,7 @@ bool VideoBackend::Initialize(void* window_handle)
|
|||||||
!PerfQuery::GetInstance()->Initialize())
|
!PerfQuery::GetInstance()->Initialize())
|
||||||
{
|
{
|
||||||
PanicAlert("Failed to initialize Vulkan classes.");
|
PanicAlert("Failed to initialize Vulkan classes.");
|
||||||
g_perf_query.reset();
|
Shutdown();
|
||||||
g_texture_cache.reset();
|
|
||||||
g_vertex_manager.reset();
|
|
||||||
g_renderer.reset();
|
|
||||||
StateTracker::DestroyInstance();
|
|
||||||
g_framebuffer_manager.reset();
|
|
||||||
g_shader_cache->Shutdown();
|
|
||||||
g_shader_cache.reset();
|
|
||||||
g_object_cache.reset();
|
|
||||||
g_command_buffer_mgr.reset();
|
|
||||||
g_vulkan_context.reset();
|
|
||||||
ShutdownShared();
|
|
||||||
UnloadVulkanLibrary();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,34 +262,33 @@ void VideoBackend::Video_Prepare()
|
|||||||
|
|
||||||
void VideoBackend::Shutdown()
|
void VideoBackend::Shutdown()
|
||||||
{
|
{
|
||||||
g_command_buffer_mgr->WaitForGPUIdle();
|
if (g_command_buffer_mgr)
|
||||||
|
g_command_buffer_mgr->WaitForGPUIdle();
|
||||||
|
|
||||||
|
g_perf_query.reset();
|
||||||
|
g_texture_cache.reset();
|
||||||
|
g_vertex_manager.reset();
|
||||||
|
g_renderer.reset();
|
||||||
|
StateTracker::DestroyInstance();
|
||||||
|
g_framebuffer_manager.reset();
|
||||||
|
if (g_shader_cache)
|
||||||
|
g_shader_cache->Shutdown();
|
||||||
g_shader_cache.reset();
|
g_shader_cache.reset();
|
||||||
g_object_cache.reset();
|
g_object_cache.reset();
|
||||||
g_command_buffer_mgr.reset();
|
g_command_buffer_mgr.reset();
|
||||||
g_vulkan_context.reset();
|
g_vulkan_context.reset();
|
||||||
|
|
||||||
UnloadVulkanLibrary();
|
|
||||||
|
|
||||||
ShutdownShared();
|
ShutdownShared();
|
||||||
|
UnloadVulkanLibrary();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoBackend::Video_Cleanup()
|
void VideoBackend::Video_Cleanup()
|
||||||
{
|
{
|
||||||
g_command_buffer_mgr->WaitForGPUIdle();
|
g_command_buffer_mgr->WaitForGPUIdle();
|
||||||
g_shader_cache->Shutdown();
|
|
||||||
|
|
||||||
// Save all cached pipelines out to disk for next time.
|
// Save all cached pipelines out to disk for next time.
|
||||||
if (g_ActiveConfig.bShaderCache)
|
if (g_ActiveConfig.bShaderCache)
|
||||||
g_shader_cache->SavePipelineCache();
|
g_shader_cache->SavePipelineCache();
|
||||||
|
|
||||||
g_perf_query.reset();
|
|
||||||
g_texture_cache.reset();
|
|
||||||
g_vertex_manager.reset();
|
|
||||||
g_framebuffer_manager.reset();
|
|
||||||
StateTracker::DestroyInstance();
|
|
||||||
g_renderer.reset();
|
|
||||||
|
|
||||||
CleanupShared();
|
CleanupShared();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user