Split VideoBackend::Cleanup from Shutdown.

First is called from ogl/d3d thread, second is called from emulation thread (x11...)
This commit is contained in:
degasus 2013-02-26 16:42:32 +01:00
parent 90ff648d00
commit 4883fa268f
10 changed files with 32 additions and 1 deletions

View File

@ -102,6 +102,7 @@ public:
virtual void Video_Prepare() = 0; virtual void Video_Prepare() = 0;
virtual void Video_EnterLoop() = 0; virtual void Video_EnterLoop() = 0;
virtual void Video_ExitLoop() = 0; virtual void Video_ExitLoop() = 0;
virtual void Video_Cleanup() = 0; // called from gl/d3d thread
virtual void Video_BeginField(u32, FieldType, u32, u32) = 0; virtual void Video_BeginField(u32, FieldType, u32, u32) = 0;
virtual void Video_EndField() = 0; virtual void Video_EndField() = 0;

View File

@ -323,6 +323,9 @@ void CpuThread()
CCPU::Run(); CCPU::Run();
g_bStarted = false; g_bStarted = false;
if (!_CoreParameter.bCPUThread)
g_video_backend->Video_Cleanup();
return; return;
} }
@ -351,6 +354,9 @@ void FifoPlayerThread()
} }
g_bStarted = false; g_bStarted = false;
if(!_CoreParameter.bCPUThread)
g_video_backend->Video_Cleanup();
return; return;
} }
@ -477,6 +483,9 @@ void EmuThread()
g_cpu_thread.join(); g_cpu_thread.join();
INFO_LOG(CONSOLE, "%s", StopMessage(true, "CPU thread stopped.").c_str()); INFO_LOG(CONSOLE, "%s", StopMessage(true, "CPU thread stopped.").c_str());
if(_CoreParameter.bCPUThread)
g_video_backend->Video_Cleanup();
VolumeHandler::EjectVolume(); VolumeHandler::EjectVolume();
FileMon::Close(); FileMon::Close();

View File

@ -15,6 +15,7 @@ class VideoBackend : public VideoBackendHardware
std::string GetName(); std::string GetName();
void Video_Prepare(); void Video_Prepare();
void Video_Cleanup();
void ShowConfig(void* parent); void ShowConfig(void* parent);

View File

@ -207,6 +207,7 @@ void VideoBackend::Shutdown()
{ {
s_BackendInitialized = false; s_BackendInitialized = false;
// TODO: should be in Video_Cleanup
if (g_renderer) if (g_renderer)
{ {
s_efbAccessRequested = FALSE; s_efbAccessRequested = FALSE;
@ -234,4 +235,7 @@ void VideoBackend::Shutdown()
} }
} }
void VideoBackend::Video_Cleanup() {
}
} }

View File

@ -15,6 +15,7 @@ class VideoBackend : public VideoBackendHardware
std::string GetName(); std::string GetName();
void Video_Prepare(); void Video_Prepare();
void Video_Cleanup();
void ShowConfig(void* parent); void ShowConfig(void* parent);

View File

@ -190,6 +190,7 @@ void VideoBackend::Shutdown()
{ {
s_BackendInitialized = false; s_BackendInitialized = false;
// TODO: should be in Video_Cleanup
if (g_renderer) if (g_renderer)
{ {
s_efbAccessRequested = FALSE; s_efbAccessRequested = FALSE;
@ -217,4 +218,7 @@ void VideoBackend::Shutdown()
D3D::Shutdown(); D3D::Shutdown();
} }
void VideoBackend::Video_Cleanup() {
}
} }

View File

@ -15,6 +15,7 @@ class VideoBackend : public VideoBackendHardware
std::string GetName(); std::string GetName();
void Video_Prepare(); void Video_Prepare();
void Video_Cleanup();
void ShowConfig(void* parent); void ShowConfig(void* parent);

View File

@ -210,7 +210,11 @@ void VideoBackend::Video_Prepare()
void VideoBackend::Shutdown() void VideoBackend::Shutdown()
{ {
s_BackendInitialized = false; s_BackendInitialized = false;
GLInterface->Shutdown();
}
void VideoBackend::Video_Cleanup() {
if (g_renderer) if (g_renderer)
{ {
s_efbAccessRequested = false; s_efbAccessRequested = false;
@ -236,7 +240,6 @@ void VideoBackend::Shutdown()
delete g_renderer; delete g_renderer;
g_renderer = NULL; g_renderer = NULL;
} }
GLInterface->Shutdown();
} }
} }

View File

@ -132,11 +132,17 @@ void VideoSoftware::EmuStateChange(EMUSTATE_CHANGE newState)
void VideoSoftware::Shutdown() void VideoSoftware::Shutdown()
{ {
// TODO: should be in Video_Cleanup
HwRasterizer::Shutdown(); HwRasterizer::Shutdown();
SWRenderer::Shutdown(); SWRenderer::Shutdown();
GLInterface->Shutdown(); GLInterface->Shutdown();
} }
void VideoSoftware::Video_Cleanup()
{
}
// This is called after Video_Initialize() from the Core // This is called after Video_Initialize() from the Core
void VideoSoftware::Video_Prepare() void VideoSoftware::Video_Prepare()
{ {

View File

@ -21,6 +21,7 @@ class VideoSoftware : public VideoBackend
void ShowConfig(void* parent); void ShowConfig(void* parent);
void Video_Prepare(); void Video_Prepare();
void Video_Cleanup();
void Video_EnterLoop(); void Video_EnterLoop();
void Video_ExitLoop(); void Video_ExitLoop();