Defer texture invalidation to the video thread from the video configuration dialog. Should fix issue 4069

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7108 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
baby.lueshi 2011-02-08 03:47:59 +00:00
parent f0adc3adb4
commit 1f0663c1a8
5 changed files with 17 additions and 7 deletions

View File

@ -31,6 +31,7 @@
#include "MainBase.h"
#include "VideoConfig.h"
#include "FramebufferManagerBase.h"
#include "TextureCacheBase.h"
#include "Fifo.h"
#include "Timer.h"
#include "StringUtil.h"
@ -109,6 +110,11 @@ void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRect
g_renderer->Swap(xfbAddr, FIELD_PROGRESSIVE, fbWidth, fbHeight,sourceRc,Gamma);
Common::AtomicStoreRelease(s_swapRequested, false);
}
if (TextureCache::DeferredInvalidate)
{
TextureCache::Invalidate(false);
}
}
void Renderer::CalculateTargetScale(int x, int y, int &scaledX, int &scaledY)

View File

@ -26,7 +26,7 @@ TextureCache *g_texture_cache;
u8 *TextureCache::temp = NULL;
TextureCache::TexCache TextureCache::textures;
Common::CriticalSection TextureCache::texMutex;
bool TextureCache::DeferredInvalidate;
TextureCache::TCacheEntryBase::~TCacheEntryBase()
{
@ -53,7 +53,6 @@ TextureCache::TextureCache()
void TextureCache::Invalidate(bool shutdown)
{
texMutex.Enter();
TexCache::iterator
iter = textures.begin(),
tcend = textures.end();
@ -68,7 +67,13 @@ void TextureCache::Invalidate(bool shutdown)
if(g_ActiveConfig.bHiresTextures && !g_ActiveConfig.bDumpTextures)
HiresTextures::Init(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str());
SetHash64Function(g_ActiveConfig.bHiresTextures || g_ActiveConfig.bDumpTextures);
texMutex.Leave();
DeferredInvalidate = false;
}
void TextureCache::InvalidateDefer()
{
DeferredInvalidate = true;
}
TextureCache::~TextureCache()

View File

@ -75,6 +75,7 @@ public:
static void Cleanup();
static void Invalidate(bool shutdown);
static void InvalidateDefer();
static void InvalidateRange(u32 start_address, u32 size);
static void MakeRangeDynamic(u32 start_address, u32 size);
static void ClearRenderTargets(); // currently only used by OGL
@ -89,7 +90,7 @@ public:
static void CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool bIsIntensityFmt,
u32 copyfmt, bool bScaleByHalf, const EFBRectangle &source_rect);
static Common::CriticalSection texMutex;
static bool DeferredInvalidate;
protected:
TextureCache();

View File

@ -158,9 +158,7 @@ void VertexManager::AddVertices(int primitive, int numVertices)
void VertexManager::Flush()
{
TextureCache::texMutex.Enter();
g_vertex_manager->vFlush();
TextureCache::texMutex.Leave();
}
// TODO: need to merge more stuff into VideoCommon to use this

View File

@ -59,7 +59,7 @@ void VideoConfigDiag::Event_Close(wxCloseEvent& ev)
EndModal(wxID_OK);
TextureCache::Invalidate(false); // For settings like hi-res textures/texture format/etc.
TextureCache::InvalidateDefer(); // For settings like hi-res textures/texture format/etc.
}
// TODO: implement some hack to increase the tooltip display duration, because some of these are way too long for anyone to read in 5 seconds.