From 7de67734838fa5d15d619c5729bfc0733aa73240 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Tue, 28 Dec 2010 12:46:00 +0000 Subject: [PATCH] Invalidate texture cache when the STC or native mipmaps options are changed. Fixes minor graphical glitches in these cases. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6677 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_VideoDX11/Src/Render.cpp | 5 +++++ Source/Plugins/Plugin_VideoDX9/Src/Render.cpp | 7 ++++++- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 11 ++++++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp index 5f923c6594..1fd7f095ed 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp @@ -950,6 +950,11 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons DLCache::ProgressiveCleanup(); TextureCache::Cleanup(); + // reload textures if these settings changed + if (g_Config.bSafeTextureCache != g_ActiveConfig.bSafeTextureCache || + g_Config.bUseNativeMips != g_ActiveConfig.bUseNativeMips) + TextureCache::Invalidate(false); + // Enable any configuration changes UpdateActiveConfig(); const bool WindowResized = CheckForResize(); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index fe7e1d389d..dff22bb627 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -870,7 +870,7 @@ void Renderer::SetBlendMode(bool forceUpdate) { if (bpmem.blendmode.logicopenable && !forceUpdate) return; - + if (bpmem.blendmode.subtract && bpmem.blendmode.blendenable) { D3D::SetRenderState(D3DRS_ALPHABLENDENABLE, true); @@ -1159,6 +1159,11 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons DLCache::ProgressiveCleanup(); TextureCache::Cleanup(); + // reload textures if these settings changed + if (g_Config.bSafeTextureCache != g_ActiveConfig.bSafeTextureCache || + g_Config.bUseNativeMips != g_ActiveConfig.bUseNativeMips) + TextureCache::Invalidate(false); + // Enable any configuration changes UpdateActiveConfig(); const bool WindowResized = CheckForResize(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 1fb540ba5c..3b1cf8b883 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -1350,11 +1350,16 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons GL_REPORT_ERRORD(); g_Config.iSaveTargetId = 0; - bool last_copy_efb_to_Texture = g_ActiveConfig.bCopyEFBToTexture; - UpdateActiveConfig(); - if (last_copy_efb_to_Texture != g_ActiveConfig.bCopyEFBToTexture) + // reload textures if these settings changed + if (g_Config.bSafeTextureCache != g_ActiveConfig.bSafeTextureCache || + g_Config.bUseNativeMips != g_ActiveConfig.bUseNativeMips) + TextureCache::Invalidate(false); + + if (g_Config.bCopyEFBToTexture != g_ActiveConfig.bCopyEFBToTexture) TextureCache::ClearRenderTargets(); + UpdateActiveConfig(); + // For testing zbuffer targets. // Renderer::SetZBufferRender(); // SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_ARB, s_FakeZTarget,