mirror of https://github.com/PCSX2/pcsx2.git
GS/HW: Don't defer TC reset until next vsync
This commit is contained in:
parent
8a08e2fd97
commit
7e64dc2576
|
@ -226,7 +226,7 @@ public:
|
||||||
std::unique_ptr<GSDumpBase> m_dump;
|
std::unique_ptr<GSDumpBase> m_dump;
|
||||||
bool m_nativeres = false;
|
bool m_nativeres = false;
|
||||||
bool m_mipmap = false;
|
bool m_mipmap = false;
|
||||||
bool m_force_preload = false;
|
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;
|
||||||
|
|
|
@ -138,10 +138,11 @@ float GSRendererHW::GetUpscaleMultiplier()
|
||||||
|
|
||||||
void GSRendererHW::Reset(bool hardware_reset)
|
void GSRendererHW::Reset(bool hardware_reset)
|
||||||
{
|
{
|
||||||
// TODO: GSreset can come from the main thread too => crash
|
// Force targets to preload for 2 frames (for 30fps games).
|
||||||
// m_tc->RemoveAll();
|
static constexpr u8 TARGET_PRELOAD_FRAMES = 2;
|
||||||
|
|
||||||
m_reset = true;
|
m_tc->RemoveAll();
|
||||||
|
m_force_preload = TARGET_PRELOAD_FRAMES;
|
||||||
|
|
||||||
GSRenderer::Reset(hardware_reset);
|
GSRenderer::Reset(hardware_reset);
|
||||||
}
|
}
|
||||||
|
@ -155,21 +156,18 @@ void GSRendererHW::UpdateSettings(const Pcsx2Config::GSOptions& old_config)
|
||||||
|
|
||||||
void GSRendererHW::VSync(u32 field, bool registers_written)
|
void GSRendererHW::VSync(u32 field, bool registers_written)
|
||||||
{
|
{
|
||||||
if (m_reset)
|
if (m_force_preload > 0)
|
||||||
{
|
{
|
||||||
m_tc->RemoveAll();
|
m_force_preload--;
|
||||||
m_reset = false;
|
if (m_force_preload == 0)
|
||||||
m_force_preload = true;
|
{
|
||||||
}
|
for (auto iter = m_draw_transfers.begin(); iter != m_draw_transfers.end();)
|
||||||
else
|
{
|
||||||
{
|
if ((s_n - iter->draw) > 5)
|
||||||
m_force_preload = false;
|
iter = m_draw_transfers.erase(iter);
|
||||||
std::vector<GSState::GSUploadQueue>::iterator iter;
|
else
|
||||||
for (iter = m_draw_transfers.begin(); iter != m_draw_transfers.end(); ) {
|
iter++;
|
||||||
if ((s_n - iter->draw) > 5)
|
}
|
||||||
iter = m_draw_transfers.erase(iter);
|
|
||||||
else
|
|
||||||
iter++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1319,7 +1317,7 @@ void GSRendererHW::Draw()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SW CLUT Render enable.
|
// SW CLUT Render enable.
|
||||||
bool preload = GSConfig.PreloadFrameWithGSData | m_force_preload;
|
bool preload = GSConfig.PreloadFrameWithGSData | (m_force_preload > 0);
|
||||||
if (GSConfig.UserHacks_CPUCLUTRender > 0 || GSConfig.UserHacks_GPUTargetCLUTMode != GSGPUTargetCLUTMode::Disabled)
|
if (GSConfig.UserHacks_CPUCLUTRender > 0 || GSConfig.UserHacks_GPUTargetCLUTMode != GSGPUTargetCLUTMode::Disabled)
|
||||||
{
|
{
|
||||||
const CLUTDrawTestResult result = (GSConfig.UserHacks_CPUCLUTRender == 2) ? PossibleCLUTDrawAggressive() : PossibleCLUTDraw();
|
const CLUTDrawTestResult result = (GSConfig.UserHacks_CPUCLUTRender == 2) ? PossibleCLUTDrawAggressive() : PossibleCLUTDraw();
|
||||||
|
|
|
@ -107,7 +107,6 @@ private:
|
||||||
int m_skip = 0;
|
int m_skip = 0;
|
||||||
int m_skip_offset = 0;
|
int m_skip_offset = 0;
|
||||||
|
|
||||||
bool m_reset = false;
|
|
||||||
bool m_tex_is_fb = false;
|
bool m_tex_is_fb = false;
|
||||||
bool m_channel_shuffle = false;
|
bool m_channel_shuffle = false;
|
||||||
bool m_userhacks_tcoffset = false;
|
bool m_userhacks_tcoffset = false;
|
||||||
|
|
|
@ -775,16 +775,17 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, con
|
||||||
// From a performance point of view, it might cost a little on big upscaling
|
// From a performance point of view, it might cost a little on big upscaling
|
||||||
// but normally few RT are miss so it must remain reasonable.
|
// but normally few RT are miss so it must remain reasonable.
|
||||||
const bool supported_fmt = !GSConfig.UserHacks_DisableDepthSupport || psm_s.depth == 0;
|
const bool supported_fmt = !GSConfig.UserHacks_DisableDepthSupport || psm_s.depth == 0;
|
||||||
const bool forced_preload = static_cast<GSRendererHW*>(g_gs_renderer.get())->m_force_preload;
|
const bool forced_preload = GSRendererHW::GetInstance()->m_force_preload > 0;
|
||||||
if ((is_frame || preload || forced_preload) && TEX0.TBW > 0 && supported_fmt)
|
if ((is_frame || preload || forced_preload) && TEX0.TBW > 0 && supported_fmt)
|
||||||
{
|
{
|
||||||
if (!is_frame && !forced_preload)
|
if (!is_frame && !forced_preload)
|
||||||
{
|
{
|
||||||
std::vector<GSState::GSUploadQueue>::iterator iter;
|
std::vector<GSState::GSUploadQueue>::iterator iter;
|
||||||
for (iter = static_cast<GSRendererHW*>(g_gs_renderer.get())->m_draw_transfers.begin(); iter != static_cast<GSRendererHW*>(g_gs_renderer.get())->m_draw_transfers.end(); ) {
|
for (iter = GSRendererHW::GetInstance()->m_draw_transfers.begin(); iter != GSRendererHW::GetInstance()->m_draw_transfers.end(); )
|
||||||
|
{
|
||||||
if (iter->blit.DBP == TEX0.TBP0 && GSUtil::HasSharedBits(iter->blit.DPSM, TEX0.PSM))
|
if (iter->blit.DBP == TEX0.TBP0 && GSUtil::HasSharedBits(iter->blit.DPSM, TEX0.PSM))
|
||||||
{
|
{
|
||||||
iter = static_cast<GSRendererHW*>(g_gs_renderer.get())->m_draw_transfers.erase(iter);
|
GSRendererHW::GetInstance()->m_draw_transfers.erase(iter);
|
||||||
GL_INS("Preloading the RT DATA");
|
GL_INS("Preloading the RT DATA");
|
||||||
const GSVector4i newrect = GSVector4i(0, 0, real_w, real_h);
|
const GSVector4i newrect = GSVector4i(0, 0, real_w, real_h);
|
||||||
AddDirtyRectTarget(dst, newrect, TEX0.PSM, TEX0.TBW);
|
AddDirtyRectTarget(dst, newrect, TEX0.PSM, TEX0.TBW);
|
||||||
|
|
Loading…
Reference in New Issue