From 8d974015d5fe3f55d26c21fa108562d47ec5aff1 Mon Sep 17 00:00:00 2001 From: "gregory.hainaut@gmail.com" Date: Wed, 1 Dec 2010 14:17:12 +0000 Subject: [PATCH] zzogl: * Create a nice FORCE_TEXDESTROY_THRESH define * do not call GetMemoryTarget twice in a row. There is already a check in the core function. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4062 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/zzogl-pg/opengl/ZZoglFlush.cpp | 23 +++++++---------------- plugins/zzogl-pg/opengl/targets.cpp | 14 +++++++------- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/plugins/zzogl-pg/opengl/ZZoglFlush.cpp b/plugins/zzogl-pg/opengl/ZZoglFlush.cpp index 60b2d35c4..4bad501ba 100644 --- a/plugins/zzogl-pg/opengl/ZZoglFlush.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglFlush.cpp @@ -1900,23 +1900,14 @@ void SetTexInt(int context, FRAGMENTSHADER* pfragment, int settexint) { tex0Info& tex0 = vb[context].tex0; - CMemoryTarget* pmemtarg = g_MemTargs.GetMemoryTarget(tex0, 1); + if (vb[context].bVarsTexSync) { + SetTexVariablesInt(context, GetTexFilter(vb[context].tex1), tex0, true, pfragment, s_bForceTexFlush); + } else { + SetTexVariablesInt(context, GetTexFilter(vb[context].tex1), tex0, false, pfragment, s_bForceTexFlush); - if (vb[context].bVarsTexSync) - { - if (vb[context].pmemtarg != pmemtarg) - { - SetTexVariablesInt(context, GetTexFilter(vb[context].tex1), tex0, true, pfragment, s_bForceTexFlush); - vb[context].bVarsTexSync = true; - } - } - else - { - SetTexVariablesInt(context, GetTexFilter(vb[context].tex1), tex0, false, pfragment, s_bForceTexFlush); - vb[context].bVarsTexSync = true; - - INC_TEXVARS(); - } + INC_TEXVARS(); + } + vb[context].bVarsTexSync = true; } else { diff --git a/plugins/zzogl-pg/opengl/targets.cpp b/plugins/zzogl-pg/opengl/targets.cpp index 6ebd8a73a..b956b4cea 100644 --- a/plugins/zzogl-pg/opengl/targets.cpp +++ b/plugins/zzogl-pg/opengl/targets.cpp @@ -59,6 +59,7 @@ bool g_bSaveZUpdate = 0; int VALIDATE_THRESH = 8; u32 TEXDESTROY_THRESH = 16; +#define FORCE_TEXDESTROY_THRESH (3) // destroy texture after FORCE_TEXDESTROY_THRESH frames void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, bool mode); void SetWriteDepth(); @@ -1817,15 +1818,14 @@ CMemoryTarget* CMemoryTargetMngr::SearchExistTarget(int start, int end, int clut { // do more validation checking. delete if not been used for a while - if (!it->ValidateTex(tex0, start, end, curstamp > it->usedstamp + 3)) + if (!it->ValidateTex(tex0, start, end, curstamp > it->usedstamp + FORCE_TEXDESTROY_THRESH)) { if (it->height <= 0) { it = DestroyTargetIter(it); - if (listTargets.size() == 0) - break; + if (listTargets.size() == 0) break; } else ++it; @@ -2228,7 +2228,7 @@ void CMemoryTargetMngr::DestroyCleared() for (list::iterator it = listClearedTargets.begin(); it != listClearedTargets.end();) { - if (it->usedstamp < curstamp - 2) + if (it->usedstamp < curstamp - (FORCE_TEXDESTROY_THRESH -1)) { it = listClearedTargets.erase(it); continue; @@ -2237,12 +2237,12 @@ void CMemoryTargetMngr::DestroyCleared() ++it; } - if ((curstamp % 3) == 0) + if ((curstamp % FORCE_TEXDESTROY_THRESH) == 0) { - // purge old targets every 3 frames + // purge old targets every FORCE_TEXDESTROY_THRESH frames for (list::iterator it = listTargets.begin(); it != listTargets.end();) { - if (it->usedstamp < curstamp - 3) + if (it->usedstamp < curstamp - FORCE_TEXDESTROY_THRESH) { it = listTargets.erase(it); continue;