summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorskidau <skidau@gmail.com>2010-10-24 04:17:36 +0000
committerskidau <skidau@gmail.com>2010-10-24 04:17:36 +0000
commit56e79aa87da99172896844d891102193f323fc5c (patch)
treee596d501cb060a964b343be7fda8cdc0d9783b8a /Source/Core
parent2ec3db44edd83ef4d8a6b9db6ac9092f45b63acc (diff)
Added a safer OpenCL shutdown procedure.
Fixes issue 3015. Fixes issue 3089. Fixes issue 3099. Fixes issue 3360. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6307 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/Src/OpenCL.cpp17
-rw-r--r--Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp4
2 files changed, 12 insertions, 9 deletions
diff --git a/Source/Core/Common/Src/OpenCL.cpp b/Source/Core/Common/Src/OpenCL.cpp
index 2d7b684074..f196fb5ed4 100644
--- a/Source/Core/Common/Src/OpenCL.cpp
+++ b/Source/Core/Common/Src/OpenCL.cpp
@@ -188,13 +188,16 @@ cl_kernel CompileKernel(cl_program program, const char *Function)
void Destroy()
{
#if defined(HAVE_OPENCL) && HAVE_OPENCL
- if(!g_context)
- return;
- clReleaseCommandQueue(g_cmdq);
- clReleaseContext(g_context);
- g_context = NULL;
- g_cmdq = NULL;
-
+ if (g_cmdq)
+ {
+ clReleaseCommandQueue(g_cmdq);
+ g_cmdq = NULL;
+ }
+ if (g_context)
+ {
+ clReleaseContext(g_context);
+ g_context = NULL;
+ }
g_bInitialized = false;
#endif
}
diff --git a/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp b/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp
index 3a93a27ea6..38ee283433 100644
--- a/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp
+++ b/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp
@@ -127,8 +127,8 @@ void TexDecoder_OpenCL_Initialize()
void TexDecoder_OpenCL_Shutdown()
{
#if defined(HAVE_OPENCL) && HAVE_OPENCL && !defined(DEBUG_OPENCL)
-
- clReleaseProgram(g_program);
+ if (g_program)
+ clReleaseProgram(g_program);
for (int i = 0; i < GX_TF_CMPR; ++i) {
if (g_DecodeParametersNative[i].kernel)