summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Rice <glennricster@gmail.com>2011-03-02 15:13:13 +0000
committerGlenn Rice <glennricster@gmail.com>2011-03-02 15:13:13 +0000
commit3ffdcf1aecddd26ab1ef2b6cd84ca0150dd78ea5 (patch)
tree6a05dbea55003d4c1bebe34ccfcfff2991b7ca8f
parenta1055bf5bf18bd79a33d29f3c0db69f537f2e1d9 (diff)
Put the video prepare code back, and use the existence of the g_renderer to determine if video prepare has been run or not.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7274 8ced0084-cf51-0410-be5f-012b33b47a6e
-rw-r--r--Source/Core/VideoCommon/Src/RenderBase.cpp2
-rw-r--r--Source/Plugins/Plugin_VideoDX11/Src/main.cpp56
-rw-r--r--Source/Plugins/Plugin_VideoDX9/Src/main.cpp52
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp9
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h1
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/main.cpp72
6 files changed, 89 insertions, 103 deletions
diff --git a/Source/Core/VideoCommon/Src/RenderBase.cpp b/Source/Core/VideoCommon/Src/RenderBase.cpp
index d822d8f02d..853c2d574d 100644
--- a/Source/Core/VideoCommon/Src/RenderBase.cpp
+++ b/Source/Core/VideoCommon/Src/RenderBase.cpp
@@ -43,7 +43,7 @@
int frameCount;
int OSDChoice, OSDTime;
-Renderer *g_renderer;
+Renderer *g_renderer = NULL;
bool s_bLastFrameDumped = false;
Common::CriticalSection Renderer::s_criticalScreenshot;
diff --git a/Source/Plugins/Plugin_VideoDX11/Src/main.cpp b/Source/Plugins/Plugin_VideoDX11/Src/main.cpp
index 42782451fe..d77836f4e5 100644
--- a/Source/Plugins/Plugin_VideoDX11/Src/main.cpp
+++ b/Source/Plugins/Plugin_VideoDX11/Src/main.cpp
@@ -174,6 +174,11 @@ bool VideoBackend::Initialize(void *&window_handle)
OSD::AddMessage("Dolphin Direct3D11 Video Backend.", 5000);
s_BackendInitialized = true;
+ return true;
+}
+
+void VideoBackend::Video_Prepare()
+{
// Better be safe...
s_efbAccessRequested = FALSE;
s_FifoShuttingDown = FALSE;
@@ -198,11 +203,6 @@ bool VideoBackend::Initialize(void *&window_handle)
PixelEngine::Init();
DLCache::Init();
- return true;
-}
-
-void VideoBackend::Video_Prepare()
-{
// Tell the host that the window is ready
Core::Callback_CoreMessage(WM_USER_CREATE);
}
@@ -211,29 +211,31 @@ void VideoBackend::Shutdown()
{
s_BackendInitialized = false;
- s_efbAccessRequested = FALSE;
- s_FifoShuttingDown = FALSE;
- s_swapRequested = FALSE;
-
- // VideoCommon
- DLCache::Shutdown();
- Fifo_Shutdown();
- CommandProcessor::Shutdown();
- PixelShaderManager::Shutdown();
- VertexShaderManager::Shutdown();
- OpcodeDecoder_Shutdown();
- VertexLoaderManager::Shutdown();
-
- // internal interfaces
- D3D::ShutdownUtils();
- PixelShaderCache::Shutdown();
- VertexShaderCache::Shutdown();
- delete g_vertex_manager;
- delete g_texture_cache;
- delete g_renderer;
+ if (g_renderer)
+ {
+ s_efbAccessRequested = FALSE;
+ s_FifoShuttingDown = FALSE;
+ s_swapRequested = FALSE;
+
+ // VideoCommon
+ DLCache::Shutdown();
+ Fifo_Shutdown();
+ CommandProcessor::Shutdown();
+ PixelShaderManager::Shutdown();
+ VertexShaderManager::Shutdown();
+ OpcodeDecoder_Shutdown();
+ VertexLoaderManager::Shutdown();
+
+ // internal interfaces
+ D3D::ShutdownUtils();
+ PixelShaderCache::Shutdown();
+ VertexShaderCache::Shutdown();
+ delete g_vertex_manager;
+ delete g_texture_cache;
+ delete g_renderer;
+ g_renderer = NULL;
+ }
EmuWindow::Close();
-
- s_BackendInitialized = false;
}
}
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp
index 6a98f37a02..37b3c7bb4d 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp
+++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp
@@ -159,6 +159,11 @@ bool VideoBackend::Initialize(void *&window_handle)
OSD::AddMessage("Dolphin Direct3D9 Video Backend.", 5000);
s_BackendInitialized = true;
+ return true;
+}
+
+void VideoBackend::Video_Prepare()
+{
// Better be safe...
s_efbAccessRequested = FALSE;
s_FifoShuttingDown = FALSE;
@@ -179,11 +184,6 @@ bool VideoBackend::Initialize(void *&window_handle)
PixelEngine::Init();
DLCache::Init();
- return true;
-}
-
-void VideoBackend::Video_Prepare()
-{
// Notify the core that the video backend is ready
Core::Callback_CoreMessage(WM_USER_CREATE);
}
@@ -192,25 +192,29 @@ void VideoBackend::Shutdown()
{
s_BackendInitialized = false;
- s_efbAccessRequested = FALSE;
- s_FifoShuttingDown = FALSE;
- s_swapRequested = FALSE;
-
- // VideoCommon
- DLCache::Shutdown();
- Fifo_Shutdown();
- CommandProcessor::Shutdown();
- PixelShaderManager::Shutdown();
- VertexShaderManager::Shutdown();
- OpcodeDecoder_Shutdown();
- VertexLoaderManager::Shutdown();
-
- // internal interfaces
- PixelShaderCache::Shutdown();
- VertexShaderCache::Shutdown();
- delete g_vertex_manager;
- delete g_texture_cache;
- delete g_renderer;
+ if (g_renderer)
+ {
+ s_efbAccessRequested = FALSE;
+ s_FifoShuttingDown = FALSE;
+ s_swapRequested = FALSE;
+
+ // VideoCommon
+ DLCache::Shutdown();
+ Fifo_Shutdown();
+ CommandProcessor::Shutdown();
+ PixelShaderManager::Shutdown();
+ VertexShaderManager::Shutdown();
+ OpcodeDecoder_Shutdown();
+ VertexLoaderManager::Shutdown();
+
+ // internal interfaces
+ PixelShaderCache::Shutdown();
+ VertexShaderCache::Shutdown();
+ delete g_vertex_manager;
+ delete g_texture_cache;
+ delete g_renderer;
+ g_renderer = NULL;
+ }
D3D::Shutdown();
EmuWindow::Close();
}
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp
index ce4198f699..2335edfa0b 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp
@@ -529,15 +529,6 @@ bool OpenGL_MakeCurrent()
return true;
}
-bool OpenGL_ReleaseContext()
-{
-#ifdef _WIN32
- return wglMakeCurrent(NULL, NULL);
-#elif defined(HAVE_X11) && HAVE_X11
- return glXMakeCurrent(GLWin.dpy, None, NULL);
-#endif
-}
-
// Update window width, size and etc. Called from Render.cpp
void OpenGL_Update()
{
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h
index 7fc635460f..23c31a1bb7 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h
+++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h
@@ -87,7 +87,6 @@ bool OpenGL_Create(void *&);
void OpenGL_Shutdown();
void OpenGL_Update();
bool OpenGL_MakeCurrent();
-bool OpenGL_ReleaseContext();
void OpenGL_SwapBuffers();
// Get status
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp
index 53c81ec032..8602552504 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp
@@ -176,12 +176,14 @@ bool VideoBackend::Initialize(void *&window_handle)
OSD::AddMessage("Dolphin OpenGL Video Backend.", 5000);
s_BackendInitialized = true;
- if (!OpenGL_MakeCurrent())
- {
- ERROR_LOG(VIDEO, "Unable to connect to OpenGL context.");
- OpenGL_Shutdown();
- return false;
- }
+ return true;
+}
+
+// This is called after Initialize() from the Core
+// Run from the graphics thread
+void VideoBackend::Video_Prepare()
+{
+ OpenGL_MakeCurrent();
g_renderer = new Renderer;
@@ -208,22 +210,6 @@ bool VideoBackend::Initialize(void *&window_handle)
TextureConverter::Init();
DLCache::Init();
- if (!OpenGL_ReleaseContext())
- {
- ERROR_LOG(VIDEO, "Unable to release OpenGL context.");
- Shutdown();
- return false;
- }
-
- return true;
-}
-
-// This is called after Initialize() from the Core
-// Run from the graphics thread
-void VideoBackend::Video_Prepare()
-{
- OpenGL_MakeCurrent();
-
// Notify the core that the video backend is ready
Core::Callback_CoreMessage(WM_USER_CREATE);
}
@@ -232,25 +218,29 @@ void VideoBackend::Shutdown()
{
s_BackendInitialized = false;
- s_efbAccessRequested = false;
- s_FifoShuttingDown = false;
- s_swapRequested = false;
- DLCache::Shutdown();
- Fifo_Shutdown();
- PostProcessing::Shutdown();
-
- // The following calls are NOT Thread Safe
- // And need to be called from the video thread
- TextureConverter::Shutdown();
- VertexLoaderManager::Shutdown();
- VertexShaderCache::Shutdown();
- VertexShaderManager::Shutdown();
- PixelShaderManager::Shutdown();
- PixelShaderCache::Shutdown();
- delete g_vertex_manager;
- delete g_texture_cache;
- OpcodeDecoder_Shutdown();
- delete g_renderer;
+ if (g_renderer)
+ {
+ s_efbAccessRequested = false;
+ s_FifoShuttingDown = false;
+ s_swapRequested = false;
+ DLCache::Shutdown();
+ Fifo_Shutdown();
+ PostProcessing::Shutdown();
+
+ // The following calls are NOT Thread Safe
+ // And need to be called from the video thread
+ TextureConverter::Shutdown();
+ VertexLoaderManager::Shutdown();
+ VertexShaderCache::Shutdown();
+ VertexShaderManager::Shutdown();
+ PixelShaderManager::Shutdown();
+ PixelShaderCache::Shutdown();
+ delete g_vertex_manager;
+ delete g_texture_cache;
+ OpcodeDecoder_Shutdown();
+ delete g_renderer;
+ g_renderer = NULL;
+ }
OpenGL_Shutdown();
}