mirror of https://github.com/PCSX2/pcsx2.git
GS/HW: Get rid of 2 frame forced preload
This commit is contained in:
parent
97672828e8
commit
c927e4785b
|
@ -228,7 +228,6 @@ public:
|
||||||
bool m_isPackedUV_HackFlag = false;
|
bool m_isPackedUV_HackFlag = false;
|
||||||
bool m_channel_shuffle = false;
|
bool m_channel_shuffle = false;
|
||||||
u8 m_scanmask_used = 0;
|
u8 m_scanmask_used = 0;
|
||||||
u8 m_force_preload = 0;
|
|
||||||
u32 m_dirty_gs_regs = 0;
|
u32 m_dirty_gs_regs = 0;
|
||||||
int m_backed_up_ctx = 0;
|
int m_backed_up_ctx = 0;
|
||||||
std::vector<GSUploadQueue> m_draw_transfers;
|
std::vector<GSUploadQueue> m_draw_transfers;
|
||||||
|
|
|
@ -95,15 +95,11 @@ float GSRendererHW::GetUpscaleMultiplier()
|
||||||
|
|
||||||
void GSRendererHW::Reset(bool hardware_reset)
|
void GSRendererHW::Reset(bool hardware_reset)
|
||||||
{
|
{
|
||||||
// Force targets to preload for 2 frames (for 30fps games).
|
|
||||||
static constexpr u8 TARGET_PRELOAD_FRAMES = 2;
|
|
||||||
|
|
||||||
// Read back on CSR Reset, conditional downloading on render swap etc handled elsewhere.
|
// Read back on CSR Reset, conditional downloading on render swap etc handled elsewhere.
|
||||||
if (!hardware_reset)
|
if (!hardware_reset)
|
||||||
g_texture_cache->ReadbackAll();
|
g_texture_cache->ReadbackAll();
|
||||||
|
|
||||||
g_texture_cache->RemoveAll();
|
g_texture_cache->RemoveAll();
|
||||||
m_force_preload = TARGET_PRELOAD_FRAMES;
|
|
||||||
|
|
||||||
GSRenderer::Reset(hardware_reset);
|
GSRenderer::Reset(hardware_reset);
|
||||||
}
|
}
|
||||||
|
@ -117,22 +113,10 @@ void GSRendererHW::UpdateSettings(const Pcsx2Config::GSOptions& old_config)
|
||||||
|
|
||||||
void GSRendererHW::VSync(u32 field, bool registers_written, bool idle_frame)
|
void GSRendererHW::VSync(u32 field, bool registers_written, bool idle_frame)
|
||||||
{
|
{
|
||||||
if (m_force_preload > 0)
|
if (GSConfig.LoadTextureReplacements)
|
||||||
{
|
GSTextureReplacements::ProcessAsyncLoadedTextures();
|
||||||
m_force_preload--;
|
|
||||||
if (m_force_preload == 0)
|
if (!idle_frame)
|
||||||
{
|
|
||||||
for (auto iter = m_draw_transfers.rbegin(); iter != m_draw_transfers.rend(); iter++)
|
|
||||||
{
|
|
||||||
if ((s_n - iter->draw) > 5)
|
|
||||||
{
|
|
||||||
m_draw_transfers.erase(m_draw_transfers.begin(), std::next(iter).base());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!idle_frame)
|
|
||||||
{
|
{
|
||||||
// If it did draws very recently, we should keep the recent stuff in case it hasn't been preloaded/used yet.
|
// If it did draws very recently, we should keep the recent stuff in case it hasn't been preloaded/used yet.
|
||||||
// Rocky Legend does this with the main menu FMV's.
|
// Rocky Legend does this with the main menu FMV's.
|
||||||
|
@ -151,24 +135,16 @@ void GSRendererHW::VSync(u32 field, bool registers_written, bool idle_frame)
|
||||||
{
|
{
|
||||||
m_draw_transfers.clear();
|
m_draw_transfers.clear();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (GSConfig.LoadTextureReplacements)
|
g_texture_cache->IncAge();
|
||||||
GSTextureReplacements::ProcessAsyncLoadedTextures();
|
|
||||||
|
|
||||||
// Don't age the texture cache when no draws or EE writes have occurred.
|
|
||||||
// Xenosaga needs its targets kept around while it's loading, because it uses them for a fade transition.
|
|
||||||
if (idle_frame)
|
|
||||||
{
|
|
||||||
GL_INS("No draws or transfers, not aging TC");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_texture_cache->IncAge();
|
// Don't age the texture cache when no draws or EE writes have occurred.
|
||||||
|
// Xenosaga needs its targets kept around while it's loading, because it uses them for a fade transition.
|
||||||
|
GL_INS("No draws or transfers, not aging TC");
|
||||||
}
|
}
|
||||||
|
|
||||||
GSRenderer::VSync(field, registers_written, idle_frame);
|
|
||||||
|
|
||||||
if (g_texture_cache->GetHashCacheMemoryUsage() > 1024 * 1024 * 1024)
|
if (g_texture_cache->GetHashCacheMemoryUsage() > 1024 * 1024 * 1024)
|
||||||
{
|
{
|
||||||
Host::AddKeyedOSDMessage("HashCacheOverflow",
|
Host::AddKeyedOSDMessage("HashCacheOverflow",
|
||||||
|
@ -182,6 +158,8 @@ void GSRendererHW::VSync(u32 field, bool registers_written, bool idle_frame)
|
||||||
|
|
||||||
m_skip = 0;
|
m_skip = 0;
|
||||||
m_skip_offset = 0;
|
m_skip_offset = 0;
|
||||||
|
|
||||||
|
GSRenderer::VSync(field, registers_written, idle_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
GSTexture* GSRendererHW::GetOutput(int i, float& scale, int& y_offset)
|
GSTexture* GSRendererHW::GetOutput(int i, float& scale, int& y_offset)
|
||||||
|
|
|
@ -1639,7 +1639,6 @@ void GSTextureCache::PreloadTarget(GIFRegTEX0 TEX0, const GSVector2i& size, cons
|
||||||
|
|
||||||
if (TEX0.TBW > 0 && supported_fmt)
|
if (TEX0.TBW > 0 && supported_fmt)
|
||||||
{
|
{
|
||||||
const bool forced_preload = GSRendererHW::GetInstance()->m_force_preload > 0;
|
|
||||||
const GSVector4i newrect = GSVector4i::loadh(size);
|
const GSVector4i newrect = GSVector4i::loadh(size);
|
||||||
const u32 rect_end = GSLocalMemory::GetUnwrappedEndBlockAddress(TEX0.TBP0, TEX0.TBW, TEX0.PSM, newrect);
|
const u32 rect_end = GSLocalMemory::GetUnwrappedEndBlockAddress(TEX0.TBP0, TEX0.TBW, TEX0.PSM, newrect);
|
||||||
|
|
||||||
|
@ -1647,7 +1646,7 @@ void GSTextureCache::PreloadTarget(GIFRegTEX0 TEX0, const GSVector2i& size, cons
|
||||||
rgba._u32 = GSUtil::GetChannelMask(TEX0.PSM);
|
rgba._u32 = GSUtil::GetChannelMask(TEX0.PSM);
|
||||||
dst->UpdateValidity(GSVector4i::loadh(valid_size));
|
dst->UpdateValidity(GSVector4i::loadh(valid_size));
|
||||||
|
|
||||||
if (!is_frame && !forced_preload && !preload)
|
if (!is_frame && !preload)
|
||||||
{
|
{
|
||||||
if (preserve_target || !draw_rect.eq(dst->m_valid))
|
if (preserve_target || !draw_rect.eq(dst->m_valid))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue