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

@ -88,38 +88,8 @@ bool VideoSoftware::Initialize(void* window_handle)
Clipper::Init();
Rasterizer::Init();
SWRenderer::Init();
DebugUtil::Init();
return true;
}
void VideoSoftware::Shutdown()
{
SWOGLWindow::Shutdown();
ShutdownShared();
}
void VideoSoftware::Video_Cleanup()
{
CleanupShared();
SWRenderer::Shutdown();
DebugUtil::Shutdown();
// The following calls are NOT Thread Safe
// And need to be called from the video thread
SWRenderer::Shutdown();
g_framebuffer_manager.reset();
g_texture_cache.reset();
g_perf_query.reset();
g_vertex_manager.reset();
g_renderer.reset();
}
// This is called after Video_Initialize() from the Core
void VideoSoftware::Video_Prepare()
{
GLInterface->MakeCurrent();
SWOGLWindow::s_instance->Prepare();
@ -127,7 +97,22 @@ void VideoSoftware::Video_Prepare()
g_vertex_manager = std::make_unique<SWVertexLoader>();
g_perf_query = std::make_unique<PerfQuery>();
g_texture_cache = std::make_unique<TextureCache>();
SWRenderer::Init();
return true;
}
void VideoSoftware::Shutdown()
{
if (g_renderer)
g_renderer->Shutdown();
DebugUtil::Shutdown();
SWOGLWindow::Shutdown();
g_framebuffer_manager.reset();
g_texture_cache.reset();
g_perf_query.reset();
g_vertex_manager.reset();
g_renderer.reset();
ShutdownShared();
}
unsigned int VideoSoftware::PeekMessages()