diff --git a/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.cpp b/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.cpp index 1fe89bee1c..092fd371ad 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.cpp @@ -219,6 +219,6 @@ void DlgSettings_Show(HINSTANCE hInstance, HWND _hParent) if(( tfoe != g_Config.bTexFmtOverlayEnable) || ((g_Config.bTexFmtOverlayEnable) && ( tfoc != g_Config.bTexFmtOverlayCenter))) { - TextureCache::Invalidate(); + TextureCache::Invalidate(false); } } \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp index d411a8ca79..d12d4879f4 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp @@ -38,12 +38,12 @@ extern int frameCount; #define TEMP_SIZE (1024*1024*4) -void TextureCache::TCacheEntry::Destroy() +void TextureCache::TCacheEntry::Destroy(bool shutdown) { if (texture) texture->Release(); texture = 0; - if (!isRenderTarget) { + if (!isRenderTarget && !shutdown) { u32 *ptr = (u32*)g_VideoInitialize.pGetMemoryPointer(addr + hashoffset*4); if (*ptr == hash) *ptr = oldpixel; @@ -56,18 +56,18 @@ void TextureCache::Init() TexDecoder_SetTexFmtOverlayOptions(g_Config.bTexFmtOverlayEnable, g_Config.bTexFmtOverlayCenter); } -void TextureCache::Invalidate() +void TextureCache::Invalidate(bool shutdown) { TexCache::iterator iter = textures.begin(); for (; iter != textures.end(); iter++) - iter->second.Destroy(); + iter->second.Destroy(shutdown); textures.clear(); TexDecoder_SetTexFmtOverlayOptions(g_Config.bTexFmtOverlayEnable, g_Config.bTexFmtOverlayCenter); } void TextureCache::Shutdown() { - Invalidate(); + Invalidate(true); if (temp != NULL) { @@ -86,7 +86,7 @@ void TextureCache::Cleanup() { if (!iter->second.isRenderTarget) { - iter->second.Destroy(); + iter->second.Destroy(false); iter = textures.erase(iter); } else @@ -162,7 +162,7 @@ void TextureCache::Load(int stage, u32 address, int width, int height, int forma } else {*/ - iter->second.Destroy(); + iter->second.Destroy(false); textures.erase(iter); //} } diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.h b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.h index 02dbf7a362..199d8603b8 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.h @@ -43,7 +43,7 @@ class TextureCache isRenderTarget=0; hash=0; } - void Destroy(); + void Destroy(bool shutdown); }; @@ -56,7 +56,7 @@ public: static void Init(); static void Cleanup(); static void Shutdown(); - static void Invalidate(); + static void Invalidate(bool shutdown); static void Load(int stage, u32 address, int width, int height, int format, int tlutaddr, int tlutfmt); static void CopyEFBToRenderTarget(u32 address, RECT *source); }; diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp index f7190e250f..36a228ed60 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp @@ -192,7 +192,7 @@ void Initialize(void *init) void DoState(unsigned char **ptr, int mode) { // Clear all caches - TextureCache::Invalidate(); + TextureCache::Invalidate(false); PointerWrap p(ptr, mode); VideoCommon_DoState(p);