GS: Auto-disable hash cache when it's too large

This commit is contained in:
Connor McLaughlin
2022-02-21 16:50:57 +01:00
committed by lightningterror
parent b389c6e103
commit ee82c7834d
+10
View File
@@ -16,6 +16,7 @@
#include "PrecompiledHeader.h"
#include "GSRendererHW.h"
#include "GS/GSGL.h"
#include "Host.h"
GSRendererHW::GSRendererHW()
: GSRenderer()
@@ -313,6 +314,15 @@ void GSRendererHW::VSync(u32 field, bool registers_written)
m_tc->IncAge();
if (m_tc->GetHashCacheMemoryUsage() > 1024 * 1024 * 1024)
{
Host::AddKeyedFormattedOSDMessage("HashCacheOverflow", 15.0f, "Hash cache has used %.2f MB of VRAM, disabling.",
static_cast<float>(m_tc->GetHashCacheMemoryUsage()) / 1048576.0f);
m_tc->RemoveAll();
g_gs_device->PurgePool();
GSConfig.TexturePreloading = TexturePreloadingLevel::Partial;
}
m_tc->PrintMemoryUsage();
g_gs_device->PrintMemoryUsage();