Fix texture cache bug in OpenGL plugin

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@393 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2008-08-30 22:55:09 +00:00
parent 432084ebe7
commit db303de0db
1 changed files with 4 additions and 4 deletions

View File

@ -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);