Invalidate the texture cache using the GPU thread when the CPU thread makes a request.

Fixes issue 6350.
This commit is contained in:
skidau 2013-06-08 11:28:54 +10:00
parent 3ff2a3a11a
commit 196d152ad7
3 changed files with 15 additions and 3 deletions

View File

@ -311,7 +311,7 @@ void ExecuteDOL(u8* dolFile, u32 fileSize)
} }
PowerPC::ppcState.iCache.Reset(); PowerPC::ppcState.iCache.Reset();
TextureCache::Invalidate(); TextureCache::RequestInvalidateTextureCache();
CWII_IPC_HLE_Device_usb_oh1_57e_305* s_Usb = GetUsbPointer(); CWII_IPC_HLE_Device_usb_oh1_57e_305* s_Usb = GetUsbPointer();
size_t size = s_Usb->m_WiiMotes.size(); size_t size = s_Usb->m_WiiMotes.size();

View File

@ -32,6 +32,7 @@ TextureCache::TexCache TextureCache::textures;
TextureCache::BackupConfig TextureCache::backup_config; TextureCache::BackupConfig TextureCache::backup_config;
bool invalidate_texture_cache_requested;
TextureCache::TCacheEntryBase::~TCacheEntryBase() TextureCache::TCacheEntryBase::~TCacheEntryBase()
{ {
@ -49,6 +50,13 @@ TextureCache::TextureCache()
HiresTextures::Init(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str()); HiresTextures::Init(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str());
SetHash64Function(g_ActiveConfig.bHiresTextures || g_ActiveConfig.bDumpTextures); SetHash64Function(g_ActiveConfig.bHiresTextures || g_ActiveConfig.bDumpTextures);
invalidate_texture_cache_requested = false;
}
void TextureCache::RequestInvalidateTextureCache()
{
invalidate_texture_cache_requested = true;
} }
void TextureCache::Invalidate() void TextureCache::Invalidate()
@ -80,7 +88,8 @@ void TextureCache::OnConfigChanged(VideoConfig& config)
if (config.iSafeTextureCache_ColorSamples != backup_config.s_colorsamples || if (config.iSafeTextureCache_ColorSamples != backup_config.s_colorsamples ||
config.bTexFmtOverlayEnable != backup_config.s_texfmt_overlay || config.bTexFmtOverlayEnable != backup_config.s_texfmt_overlay ||
config.bTexFmtOverlayCenter != backup_config.s_texfmt_overlay_center || config.bTexFmtOverlayCenter != backup_config.s_texfmt_overlay_center ||
config.bHiresTextures != backup_config.s_hires_textures) config.bHiresTextures != backup_config.s_hires_textures ||
invalidate_texture_cache_requested)
{ {
g_texture_cache->Invalidate(); g_texture_cache->Invalidate();
@ -89,6 +98,8 @@ void TextureCache::OnConfigChanged(VideoConfig& config)
SetHash64Function(g_ActiveConfig.bHiresTextures || g_ActiveConfig.bDumpTextures); SetHash64Function(g_ActiveConfig.bHiresTextures || g_ActiveConfig.bDumpTextures);
TexDecoder_SetTexFmtOverlayOptions(g_ActiveConfig.bTexFmtOverlayEnable, g_ActiveConfig.bTexFmtOverlayCenter); TexDecoder_SetTexFmtOverlayOptions(g_ActiveConfig.bTexFmtOverlayEnable, g_ActiveConfig.bTexFmtOverlayCenter);
invalidate_texture_cache_requested = false;
} }
// TODO: Probably shouldn't clear all render targets here, just mark them dirty or something. // TODO: Probably shouldn't clear all render targets here, just mark them dirty or something.

View File

@ -107,6 +107,8 @@ public:
static void CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat, unsigned int srcFormat, static void CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat, unsigned int srcFormat,
const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf); const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf);
static void RequestInvalidateTextureCache();
protected: protected:
TextureCache(); TextureCache();
@ -118,7 +120,6 @@ private:
static PC_TexFormat LoadCustomTexture(u64 tex_hash, int texformat, unsigned int level, unsigned int& width, unsigned int& height); static PC_TexFormat LoadCustomTexture(u64 tex_hash, int texformat, unsigned int level, unsigned int& width, unsigned int& height);
static void DumpTexture(TCacheEntryBase* entry, unsigned int level); static void DumpTexture(TCacheEntryBase* entry, unsigned int level);
typedef std::map<u32, TCacheEntryBase*> TexCache; typedef std::map<u32, TCacheEntryBase*> TexCache;
static TexCache textures; static TexCache textures;