From db303de0dbd2aeba347b1d23de27d16c581f7a50 Mon Sep 17 00:00:00 2001 From: hrydgard Date: Sat, 30 Aug 2008 22:55:09 +0000 Subject: [PATCH] Fix texture cache bug in OpenGL plugin git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@393 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp b/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp index 23547096b7..5aea8eab86 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp @@ -82,6 +82,9 @@ void TextureMngr::TCacheEntry::SetTextureParameters(TexMode0& newmode) void TextureMngr::TCacheEntry::Destroy() { glDeleteTextures(1, &texture); + u32 *ptr = (u32*)g_VideoInitialize.pGetMemoryPointer(addr + hashoffset*4); + if (*ptr == hash) + *ptr = oldpixel; texture = 0; } @@ -123,12 +126,9 @@ void TextureMngr::Cleanup() { TexCache::iterator iter = textures.begin(); - while(iter!=textures.end()) { + while(iter != textures.end()) { if (frameCount > 20 + iter->second.frameCount) { if (!iter->second.isRenderTarget) { - u32 *ptr = (u32*)g_VideoInitialize.pGetMemoryPointer(iter->second.addr + iter->second.hashoffset*4); - if (*ptr == iter->second.hash) - *ptr = iter->second.oldpixel; iter->second.Destroy(); #ifdef _WIN32 iter = textures.erase(iter);