Merge pull request #6334 from stenzek/startup

Video Backend Initialization/Core Boot Improvements
This commit is contained in:
Anthony
2018-02-07 23:35:54 -08:00
committed by GitHub
24 changed files with 89 additions and 290 deletions

View File

@ -17,13 +17,6 @@ class VideoBackend : public VideoBackendBase
std::string GetName() const override;
std::string GetDisplayName() const override;
void Video_Prepare() override;
void Video_Cleanup() override;
void InitBackendInfo() override;
unsigned int PeekMessages() override;
void* m_window_handle;
};
}

View File

@ -26,19 +26,6 @@
namespace DX11
{
unsigned int VideoBackend::PeekMessages()
{
MSG msg;
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
return FALSE;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return TRUE;
}
std::string VideoBackend::GetName() const
{
return "D3D";
@ -145,32 +132,30 @@ bool VideoBackend::Initialize(void* window_handle)
InitBackendInfo();
InitializeShared();
m_window_handle = window_handle;
return true;
}
void VideoBackend::Video_Prepare()
{
if (FAILED(D3D::Create(reinterpret_cast<HWND>(m_window_handle))))
if (FAILED(D3D::Create(reinterpret_cast<HWND>(window_handle))))
{
PanicAlert("Failed to create D3D device.");
return false;
}
// internal interfaces
g_renderer = std::make_unique<Renderer>();
g_texture_cache = std::make_unique<TextureCache>();
g_vertex_manager = std::make_unique<VertexManager>();
g_perf_query = std::make_unique<PerfQuery>();
VertexShaderCache::Init();
PixelShaderCache::Init();
GeometryShaderCache::Init();
VertexShaderCache::WaitForBackgroundCompilesToComplete();
D3D::InitUtils();
BBox::Init();
return true;
}
void VideoBackend::Shutdown()
{
// TODO: should be in Video_Cleanup
g_renderer->Shutdown();
D3D::ShutdownUtils();
PixelShaderCache::Shutdown();
VertexShaderCache::Shutdown();
@ -182,13 +167,8 @@ void VideoBackend::Shutdown()
g_texture_cache.reset();
g_renderer.reset();
D3D::Close();
ShutdownShared();
}
void VideoBackend::Video_Cleanup()
{
CleanupShared();
D3D::Close();
}
}