diff options
| author | skidau <skidau@gmail.com> | 2011-03-19 02:28:49 +0000 |
|---|---|---|
| committer | skidau <skidau@gmail.com> | 2011-03-19 02:28:49 +0000 |
| commit | aac297296069e5cb9487e58fe45339154bb106cd (patch) | |
| tree | 45e30877682e253d472ee4c9e170fca20824d726 /Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp | |
| parent | 50c5dbdb096ebc340c8c40cd3b70c2ba865e0790 (diff) | |
Fixed a memory leak that occurred while compiling the OpenCL kernels.
Reset the frame counter after loading a save.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7376 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp b/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp index 72643c617f..3d0eeaae96 100644 --- a/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp +++ b/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp @@ -147,6 +147,7 @@ void TexDecoder_OpenCL_Initialize() delete binary; } + // If an error occurred using the kernel binary, recompile the kernels if (err) { std::string code; @@ -182,7 +183,7 @@ void TexDecoder_OpenCL_Initialize() binaries = (char **)malloc(sizeof(char *)*nDevices); for (u32 i = 0; i < nDevices; ++i) { - if( binary_sizes[i] != 0 ) + if (binary_sizes[i] != 0) { binaries[i] = (char *)malloc(HEADER_SIZE + binary_sizes[i]); } @@ -213,9 +214,23 @@ void TexDecoder_OpenCL_Initialize() output.WriteBytes(binaries[0], binary_sizes[0]); } } + for (u32 i = 0; i < nDevices; ++i) + { + if (binary_sizes[i] != NULL) + { + free(binaries[i]); + } + } + if (binaries != NULL) + free(binaries); + if (binary_sizes != NULL) + free(binary_sizes); + if (devices != NULL) + free(devices); } - for (int i = 0; i <= GX_TF_CMPR; ++i) { + for (int i = 0; i <= GX_TF_CMPR; ++i) + { if (g_DecodeParametersNative[i].name) g_DecodeParametersNative[i].kernel = OpenCL::CompileKernel(g_program, |
