GS/HW: Allow more draws to remain if recent draws done near vsync

This commit is contained in:
refractionpcsx2 2023-11-24 13:35:58 +00:00
parent 7853843b0b
commit d25246a212
4 changed files with 12 additions and 7 deletions

View File

@ -944,6 +944,11 @@ bool GSRenderer::IsIdleFrame() const
return (m_last_draw_n == s_n && m_last_transfer_n == s_transfer_n); return (m_last_draw_n == s_n && m_last_transfer_n == s_transfer_n);
} }
int GSRenderer::GetLastVSyncDraw() const
{
return m_last_draw_n;
}
bool GSRenderer::SaveSnapshotToMemory(u32 window_width, u32 window_height, bool apply_aspect, bool crop_borders, bool GSRenderer::SaveSnapshotToMemory(u32 window_width, u32 window_height, bool apply_aspect, bool crop_borders,
u32* width, u32* height, std::vector<u32>* pixels) u32* width, u32* height, std::vector<u32>* pixels)
{ {

View File

@ -68,6 +68,7 @@ public:
virtual GSTexture* LookupPaletteSource(u32 CBP, u32 CPSM, u32 CBW, GSVector2i& offset, float* scale, const GSVector2i& size); virtual GSTexture* LookupPaletteSource(u32 CBP, u32 CPSM, u32 CBW, GSVector2i& offset, float* scale, const GSVector2i& size);
bool IsIdleFrame() const; bool IsIdleFrame() const;
int GetLastVSyncDraw() const;
bool SaveSnapshotToMemory(u32 window_width, u32 window_height, bool apply_aspect, bool crop_borders, bool SaveSnapshotToMemory(u32 window_width, u32 window_height, bool apply_aspect, bool crop_borders,
u32* width, u32* height, std::vector<u32>* pixels); u32* width, u32* height, std::vector<u32>* pixels);

View File

@ -113,11 +113,11 @@ void GSRendererHW::VSync(u32 field, bool registers_written, bool 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.
if (s_last_transfer_draw_n == s_n) if (s_last_transfer_draw_n > (s_n - 5) && s_last_transfer_draw_n >= GetLastVSyncDraw())
{ {
for (auto iter = m_draw_transfers.rbegin(); iter != m_draw_transfers.rend(); iter++) for (auto iter = m_draw_transfers.rbegin(); iter != m_draw_transfers.rend(); iter++)
{ {
if ((s_n - iter->draw) > 5) if ((s_n - iter->draw) > 50)
{ {
m_draw_transfers.erase(m_draw_transfers.begin(), std::next(iter).base()); m_draw_transfers.erase(m_draw_transfers.begin(), std::next(iter).base());
break; break;

View File

@ -2411,12 +2411,11 @@ GSTextureCache::Target* GSTextureCache::LookupDisplayTarget(GIFRegTEX0 TEX0, con
else else
++iter; ++iter;
if (eerect.rintersect(newrect).eq(newrect)) // In theory it might not be a full rect, but it should be enough to display *something*.
{ // It's also possible we haven't saved enough of the transfers to fill the rect if the game draws the picture in lots of small transfers.
can_create = true; can_create = true;
break; break;
} }
}
else else
++iter; ++iter;
} }