VideoBackends: Combine Initialize/Prepare and Cleanup/Shutdown methods

Also allows the work previously done in Prepare to return a failure
status.
This commit is contained in:
Stenzek
2018-01-26 15:09:07 +10:00
parent 04027a7da7
commit d96e8c9d76
20 changed files with 58 additions and 160 deletions

View File

@ -76,6 +76,9 @@ void ShaderCache::Shutdown()
m_async_shader_compiler->StopWorkerThreads();
m_async_shader_compiler->RetrieveWorkItems();
}
if (g_ActiveConfig.bShaderCache && m_pipeline_cache != VK_NULL_HANDLE)
SavePipelineCache();
}
static bool IsStripPrimitiveTopology(VkPrimitiveTopology topology)

View File

@ -16,9 +16,6 @@ public:
std::string GetName() const override { return "Vulkan"; }
std::string GetDisplayName() const override { return "Vulkan (experimental)"; }
void Video_Prepare() override;
void Video_Cleanup() override;
void InitBackendInfo() override;
unsigned int PeekMessages() override { return 0; }

View File

@ -245,22 +245,16 @@ bool VideoBackend::Initialize(void* window_handle)
if (g_ActiveConfig.CanPrecompileUberShaders())
g_shader_cache->PrecompileUberShaders();
// Display the name so the user knows which device was actually created.
INFO_LOG(VIDEO, "Vulkan Device: %s", g_vulkan_context->GetDeviceProperties().deviceName);
return true;
}
// This is called after Initialize() from the Core
// Run from the graphics thread
void VideoBackend::Video_Prepare()
{
// Display the name so the user knows which device was actually created
OSD::AddMessage(StringFromFormat("Using physical adapter %s",
g_vulkan_context->GetDeviceProperties().deviceName)
.c_str(),
5000);
}
void VideoBackend::Shutdown()
{
if (g_renderer)
g_renderer->Shutdown();
if (g_command_buffer_mgr)
g_command_buffer_mgr->WaitForGPUIdle();
@ -279,15 +273,4 @@ void VideoBackend::Shutdown()
ShutdownShared();
UnloadVulkanLibrary();
}
void VideoBackend::Video_Cleanup()
{
g_command_buffer_mgr->WaitForGPUIdle();
// Save all cached pipelines out to disk for next time.
if (g_ActiveConfig.bShaderCache)
g_shader_cache->SavePipelineCache();
CleanupShared();
}
}