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

@ -45,15 +45,6 @@ void VideoBackendBase::Video_ExitLoop()
s_FifoShuttingDown.Set();
}
void VideoBackendBase::Video_CleanupShared()
{
// First stop any framedumping, which might need to dump the last xfb frame. This process
// can require additional graphics sub-systems so it needs to be done first
g_renderer->ShutdownFrameDumping();
Video_Cleanup();
}
// Run from the CPU thread (from VideoInterface.cpp)
void VideoBackendBase::Video_BeginField(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
u64 ticks)
@ -211,12 +202,8 @@ void VideoBackendBase::ShutdownShared()
m_initialized = false;
Fifo::Shutdown();
}
void VideoBackendBase::CleanupShared()
{
VertexLoaderManager::Clear();
Fifo::Shutdown();
}
// Run from the CPU thread

View File

@ -101,6 +101,13 @@ Renderer::Renderer(int backbuffer_width, int backbuffer_height)
Renderer::~Renderer() = default;
void Renderer::Shutdown()
{
// First stop any framedumping, which might need to dump the last xfb frame. This process
// can require additional graphics sub-systems so it needs to be done first
ShutdownFrameDumping();
}
void Renderer::RenderToXFB(u32 xfbAddr, const EFBRectangle& sourceRc, u32 fbStride, u32 fbHeight,
float Gamma)
{

View File

@ -154,7 +154,7 @@ public:
virtual void ChangeSurface(void* new_surface_handle) {}
bool UseVertexDepthRange() const;
void ShutdownFrameDumping();
virtual void Shutdown();
protected:
std::tuple<int, int> CalculateTargetScale(int x, int y) const;
@ -243,6 +243,7 @@ private:
std::string GetFrameDumpNextImageFileName() const;
bool StartFrameDumpToImage(const FrameDumpConfig& config);
void DumpFrameToImage(const FrameDumpConfig& config);
void ShutdownFrameDumping();
bool IsFrameDumping();

View File

@ -45,12 +45,8 @@ public:
void ShowConfig(void*);
virtual void InitBackendInfo() = 0;
virtual void Video_Prepare() = 0;
void Video_ExitLoop();
void Video_CleanupShared(); // called from gl/d3d thread
virtual void Video_Cleanup() = 0;
void Video_BeginField(u32, u32, u32, u32, u64);
u32 Video_AccessEFB(EFBAccessType, u32, u32, u32);
@ -70,7 +66,6 @@ public:
protected:
void InitializeShared();
void ShutdownShared();
void CleanupShared();
bool m_initialized = false;
bool m_invalid = false;