From c63446827f395934883e21de08586a83e1d9728f Mon Sep 17 00:00:00 2001 From: Sonicadvance1 Date: Sat, 13 Feb 2010 10:09:54 +0000 Subject: [PATCH] Fix crash when stopping and starting a game with OpenCL enabled git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5047 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/OpenCL.cpp | 4 ++++ Source/Core/VideoCommon/Src/OpcodeDecoding.cpp | 2 +- Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/Core/Common/Src/OpenCL.cpp b/Source/Core/Common/Src/OpenCL.cpp index 44ae1e8a53..660da5d382 100644 --- a/Source/Core/Common/Src/OpenCL.cpp +++ b/Source/Core/Common/Src/OpenCL.cpp @@ -180,6 +180,10 @@ void Destroy() return; clReleaseCommandQueue(g_cmdq); clReleaseContext(g_context); + g_context = NULL; + g_cmdq = NULL; + + g_bInitialized = false; #endif } diff --git a/Source/Core/VideoCommon/Src/OpcodeDecoding.cpp b/Source/Core/VideoCommon/Src/OpcodeDecoding.cpp index 8511b38864..eab59281a1 100644 --- a/Source/Core/VideoCommon/Src/OpcodeDecoding.cpp +++ b/Source/Core/VideoCommon/Src/OpcodeDecoding.cpp @@ -394,8 +394,8 @@ void OpcodeDecoder_Init() void OpcodeDecoder_Shutdown() { #if defined(HAVE_OPENCL) && HAVE_OPENCL - OpenCL::Destroy(); TexDecoder_OpenCL_Shutdown(); + OpenCL::Destroy(); #endif } diff --git a/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp b/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp index ed94362fe4..f454b3b0ce 100644 --- a/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp +++ b/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp @@ -99,11 +99,14 @@ void TexDecoder_OpenCL_Shutdown() { clReleaseKernel(Decoders[i].kernel); i++; } + if(g_clsrc) clReleaseMemObject(g_clsrc); if(g_cldst) clReleaseMemObject(g_cldst); + + g_Inited = false; #endif }