GSDX: Skip checking each palette entry's expanded alpha when deciding whether a texture is fully opaque. Textures are probably almost never determined to be opaque by this and doing it is problematic. (Skipping the check might even be a performance gain for hardware, you never know.)

Also remove some (probably mangled) chinese comments from the cutie merge.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5311 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
sudonim1@gmail.com 2012-06-19 01:02:52 +00:00
parent 0d9eca8668
commit 21522e71b2
3 changed files with 64 additions and 133 deletions

View File

@ -318,73 +318,6 @@ void GSClut::Read32(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA)
}
}
void GSClut::GetAlphaMinMax32(int& amin, int& amax)
{
// call only after Read32
ASSERT(!m_read.dirty);
if(m_read.adirty)
{
m_read.adirty = false;
if(GSLocalMemory::m_psm[m_read.TEX0.CPSM].trbpp == 24 && m_read.TEXA.AEM == 0)
{
m_read.amin = m_read.TEXA.TA0;
m_read.amax = m_read.TEXA.TA0;
}
else
{
const GSVector4i* p = (const GSVector4i*)m_buff32;
GSVector4i amin, amax;
if(GSLocalMemory::m_psm[m_read.TEX0.PSM].pal == 256)
{
amin = GSVector4i::xffffffff();
amax = GSVector4i::zero();
for(int i = 0; i < 16; i++)
{
GSVector4i v0 = (p[i * 4 + 0] >> 24).ps32(p[i * 4 + 1] >> 24);
GSVector4i v1 = (p[i * 4 + 2] >> 24).ps32(p[i * 4 + 3] >> 24);
GSVector4i v2 = v0.pu16(v1);
amin = amin.min_u8(v2);
amax = amax.max_u8(v2);
}
}
else
{
ASSERT(GSLocalMemory::m_psm[m_read.TEX0.PSM].pal == 16);
GSVector4i v0 = (p[0] >> 24).ps32(p[1] >> 24);
GSVector4i v1 = (p[2] >> 24).ps32(p[3] >> 24);
GSVector4i v2 = v0.pu16(v1);
amin = v2;
amax = v2;
}
amin = amin.min_u8(amin.zwxy());
amax = amax.max_u8(amax.zwxy());
amin = amin.min_u8(amin.zwxyl());
amax = amax.max_u8(amax.zwxyl());
amin = amin.min_u8(amin.yxwzl());
amax = amax.max_u8(amax.yxwzl());
GSVector4i v0 = amin.upl8(amax).u8to16();
GSVector4i v1 = v0.yxwz();
m_read.amin = v0.min_i16(v1).extract16<0>();
m_read.amax = v0.max_i16(v1).extract16<1>();
}
}
amin = m_read.amin;
amax = m_read.amax;
}
//
void GSClut::WriteCLUT_T32_I8_CSM1(const uint32* RESTRICT src, uint16* RESTRICT clut)

View File

@ -101,7 +101,6 @@ public:
void Write(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT);
void Read(const GIFRegTEX0& TEX0);
void Read32(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA);
void GetAlphaMinMax32(int& amin, int& amax);
uint32 operator [] (size_t i) const {return m_buff32[i];}

View File

@ -2654,7 +2654,10 @@ void GSState::GetAlphaMinMax()
if(PRIM->TME && context->TEX0.TCC)
{
switch(GSLocalMemory::m_psm[context->TEX0.PSM].fmt)
const GSLocalMemory::psm_t& psm = GSLocalMemory::m_psm[context->TEX0.PSM];
const GSLocalMemory::psm_t& cpsm = psm.pal > 0 ? GSLocalMemory::m_psm[context->TEX0.CPSM] : psm;
switch(cpsm.fmt)
{
case 0:
a.y = 0;
@ -2668,9 +2671,6 @@ void GSState::GetAlphaMinMax()
a.y = env.TEXA.AEM ? 0 : min(env.TEXA.TA0, env.TEXA.TA1);
a.w = max(env.TEXA.TA0, env.TEXA.TA1);
break;
case 3:
m_mem.m_clut.GetAlphaMinMax32(a.y, a.w);
break;
default:
__assume(0);
}
@ -3127,7 +3127,7 @@ bool GSC_ICO(const GSFrameInfo& fi, int& skip)
}
else if( g_aggressive && fi.TME && fi.FBP == 0x0800 && (fi.TBP0 == 0x2800 || fi.TBP0 ==0x2c00) && fi.TPSM ==0 && fi.FBMSK == 0)
{
skip = 1; //重影
skip = 1;
}
}
else
@ -3281,7 +3281,7 @@ bool GSC_ResidentEvil4(const GSFrameInfo& fi, int& skip)
}
else if(fi.TME && fi.FBP ==0x03100 && (fi.TBP0==0x2a00 ||fi.TBP0==0x3480) && fi.TPSM ==0 && fi.FBMSK == 0)
{
skip = 1; //重影
skip = 1;
}
}
@ -3446,11 +3446,11 @@ bool GSC_GodOfWar2(const GSFrameInfo& fi, int& skip)
{
skip = 1; // wall of fog
}
else if(g_aggressive && fi.TPSM == PSM_PSMCT24 && fi.TME && (fi.FBP ==0x1300 ) && (fi.TBP0 ==0x0F00 || fi.TBP0 ==0x1300 || fi.TBP0==0x2b00)) // || fi.FBP == 0x0100 //消水下黑線跟光源
else if(g_aggressive && fi.TPSM == PSM_PSMCT24 && fi.TME && (fi.FBP ==0x1300 ) && (fi.TBP0 ==0x0F00 || fi.TBP0 ==0x1300 || fi.TBP0==0x2b00)) // || fi.FBP == 0x0100
{
skip = 1; // global haze/halo
}
else if(g_aggressive && fi.TPSM == PSM_PSMCT24 && fi.TME && (fi.FBP ==0x0100 ) && (fi.TBP0==0x2b00 || fi.TBP0==0x2e80)) //480P2e80
else if(g_aggressive && fi.TPSM == PSM_PSMCT24 && fi.TME && (fi.FBP ==0x0100 ) && (fi.TBP0==0x2b00 || fi.TBP0==0x2e80)) //480P 2e80
{
skip = 1; // water effect and water vertical lines
}
@ -3566,15 +3566,15 @@ bool GSC_Genji(const GSFrameInfo& fi, int& skip)
{
if(fi.TME && fi.FBP == 0x01500 && fi.FPSM == PSM_PSMCT16 && fi.TBP0 == 0x00e00 && fi.TPSM == PSM_PSMZ16)
{
skip = 6; //左上方缺塊
skip = 6;
}
else if(fi.TPSM == PSM_PSMCT24 && fi.TME ==0x0001 && fi.TBP0==fi.FBP)
{
skip = 1; // 模糊
skip = 1;
}
else if(fi.TPSM == PSM_PSMT8H && fi.FBMSK == 0)
{
skip = 1; //白霧
skip = 1;
}
}
else
@ -3638,11 +3638,11 @@ bool GSC_RadiataStories(const GSFrameInfo& fi, int& skip)
{
if(fi.TME && fi.FPSM == fi.TPSM && fi.TPSM == PSM_PSMCT16 && fi.FBMSK == 0x03FFF)
{
skip = 1; // CMV的豎紋
skip = 1;
}
else if(fi.TME && fi.FBP == fi.TBP0 && fi.FPSM == PSM_PSMCT32 && fi.TPSM == PSM_PSMT4HH)
{
skip = 1000; //
skip = 1000;
}
}
else
@ -3670,11 +3670,11 @@ bool GSC_HauntingGround(const GSFrameInfo& fi, int& skip)
}
else if(fi.TME && (fi.FBP ==0x2200) && (fi.TBP0 ==0x3a80) && fi.FPSM == fi.TPSM && fi.TPSM == PSM_PSMCT32)
{
skip = 1; // 模糊
skip = 1;
}
else if(fi.FBP ==0x2200 && fi.TBP0==0x3000 && fi.TPSM == PSM_PSMT8H && fi.FBMSK == 0)
{
skip = 1; //霧
skip = 1;
}
else if(fi.TME)
{
@ -3732,12 +3732,11 @@ bool GSC_CaptainTsubasa(const GSFrameInfo& fi, int& skip)
bool GSC_Oneechanbara2Special(const GSFrameInfo& fi, int& skip)
{
// 高分辨率下重影
if(skip == 0)
{
if(fi.TPSM == PSM_PSMCT24 && fi.TME && fi.FBP == 0x01180)
{
skip = 1; // 重影
skip = 1;
}
}
@ -3799,7 +3798,7 @@ bool GSC_EternalPoison(const GSFrameInfo& fi, int& skip)
{
if(fi.TPSM == PSM_PSMCT16S && fi.TBP0 == 0x3200)
{
skip = 1; //陰影
skip = 1;
}
}
return true;
@ -3811,7 +3810,7 @@ bool GSC_LegoBatman(const GSFrameInfo& fi, int& skip)
{
if(fi.TME && fi.TPSM == PSM_PSMZ16 && fi.FPSM == PSM_PSMCT16 && fi.FBMSK == 0x00000)
{
skip = 3; //去黑霧
skip = 3;
}
}
return true;
@ -3908,19 +3907,19 @@ bool GSC_ShadowofRome(const GSFrameInfo& fi, int& skip)
{
if(fi.FBP && fi.TPSM == PSM_PSMT8H && ( fi.FBMSK ==0x00FFFFFF))
{
skip =1; //霧
skip =1;
}
else if(fi.TME ==0x0001 && (fi.TBP0==0x1300 || fi.TBP0==0x0f00) && fi.FBMSK>=0xFFFFFF)
{
skip = 1; //樹林霧和水紋
skip = 1;
}
else if(fi.TME && (fi.FBP >=0x0) && fi.FPSM == PSM_PSMCT32 && (fi.TBP0 ==0x0160 ||fi.TBP0==0x01e0 || fi.TBP0<=0x0800) && fi.TPSM == PSM_PSMT8)
{
skip = 1; //速度
skip = 1;
}
else if(fi.TME && (fi.TBP0==0x0700) && (fi.TPSM == PSM_PSMCT32 || fi.TPSM == PSM_PSMCT24))
{
skip = 1; //模糊
skip = 1;
}
}
@ -4232,11 +4231,11 @@ bool GSC_TombRaiderLegend(const GSFrameInfo& fi, int& skip)
{
if(fi.TME && fi.FBP == 0x01000 && fi.FPSM == fi.TPSM && fi.TPSM == PSM_PSMCT32 && (fi.TBP0 == 0x2b60 ||fi.TBP0 == 0x2b80 || fi.TBP0 == 0x2E60 ||fi.TBP0 ==0x3020 ||fi.TBP0 == 0x3200 || fi.TBP0 == 0x3320))
{
skip = 1; //花屏
skip = 1;
}
else if(fi.TPSM == PSM_PSMCT32 && (fi.TPSM | fi.FBP)==0x2fa0 && (fi.TBP0==0x2bc0 ) && fi.FBMSK ==0)
{
skip = 2; // 花屏
skip = 2;
}
@ -4251,15 +4250,15 @@ bool GSC_TombRaiderUnderWorld(const GSFrameInfo& fi, int& skip)
{
if(fi.TME && fi.FBP == 0x01000 && fi.FPSM == fi.TPSM && fi.TPSM == PSM_PSMCT32 && (fi.TBP0 == 0x2B60 /*|| fi.TBP0 == 0x2EFF || fi.TBP0 ==0x2F00 || fi.TBP0 == 0x3020*/ || fi.TBP0 >= 0x2C01 && fi.TBP0!=0x3029 && fi.TBP0!=0x302d))
{
skip = 1; //花屏
skip = 1;
}
else if(fi.TPSM == PSM_PSMCT32 && (fi.TPSM | fi.FBP)==0x2c00 && (fi.TBP0 ==0x0ee0) && fi.FBMSK ==0)
{
skip = 2; // 水下黑屏
skip = 2;
}
/*else if(fi.TPSM == PSM_PSMCT16 && (fi.TPSM | fi.FBP)>=0x0 && (fi.TBP0 >=0x0) && fi.FBMSK ==0)
{
skip = 600; // 加速
skip = 600;
}*/
}
@ -4474,15 +4473,15 @@ bool GSC_TalesOfLegendia(const GSFrameInfo& fi, int& skip)
}
if(fi.TME && fi.FBP && fi.FPSM == PSM_PSMCT32 && fi.TBP0 == 0x3d80)
{
skip = 1; //左上方缺塊2a00
skip = 1;
}
if(fi.TME && fi.FBP ==0x1c00 && (fi.TBP0==0x2e80 ||fi.TBP0==0x2d80) && fi.TPSM ==0 && fi.FBMSK == 0xff000000)
{
skip = 1; //重影
skip = 1;
}
if(!fi.TME && fi.FBP ==0x2a00 && (fi.TBP0==0x1C00 ) && fi.TPSM ==0 && fi.FBMSK == 0x00FFFFFF)
{
skip = 1; //中毒圖層錯位
skip = 1;
}
}
@ -4512,7 +4511,7 @@ bool GSC_Kunoichi(const GSFrameInfo& fi, int& skip)
}
if(fi.TME && (fi.FBP ==0x0700 || fi.FBP==0) && fi.TBP0==0x0e00 && fi.TPSM ==0 && fi.FBMSK == 0)
{
skip = 1; //殺陣黑屏
skip = 1;
}
if(fi.TME)
{
@ -4622,7 +4621,7 @@ bool GSC_ZettaiZetsumeiToshi2(const GSFrameInfo& fi, int& skip)
}
else if(fi.TME && fi.TPSM == PSM_PSMCT32 && fi.FBMSK == 0xFF000000)
{
skip = 2; // 霧
skip = 2;
}
else if((fi.FBP | fi.TBP0)&& fi.FPSM == fi.TPSM && fi.TPSM == PSM_PSMCT16 && fi.FBMSK == 0x3FFF)
{
@ -4669,24 +4668,24 @@ bool GSC_ShinOnimusha(const GSFrameInfo& fi, int& skip)
if(fi.TME && fi.FBP == 0x001000 && (fi.TBP0 ==0 || fi.TBP0 == 0x0800) && fi.TPSM == PSM_PSMT8H && fi.FBMSK == 0x00FFFFFF)
{
skip = 0; //水波紋 沒必要了?
skip = 0;
}
else if(fi.TPSM == PSM_PSMCT24 && fi.TME && fi.FBP == 0x01000) // || fi.FBP == 0x00000
{
skip = 28; // 重影28 30 56 64
skip = 28; //28 30 56 64
}
else if(fi.FBP && fi.TPSM == PSM_PSMT8H && fi.FBMSK == 0xFFFFFF)
{
skip = 0; //24 33 40 92白霧 沒必要了?
skip = 0; //24 33 40 9
}
else if(fi.TPSM == PSM_PSMT8H && fi.FBMSK == 0xFF000000)
{
skip = 1; //撿東西時的白霧
skip = 1;
}
else if(fi.TME && (fi.TBP0 ==0x1400 || fi.TBP0 ==0x1000 ||fi.TBP0 == 0x1200) && (fi.TPSM == PSM_PSMCT32 || fi.TPSM == PSM_PSMCT24))
{
skip = 1;
} //消除泛光過度 水紋等光影
}
}
@ -4699,19 +4698,19 @@ bool GSC_XE3(const GSFrameInfo& fi, int& skip)
{
if(fi.TPSM == PSM_PSMT8H && fi.FBMSK >= 0xEFFFFFFF)
{
skip = 73; //動畫
skip = 73;
}
else if(fi.TME && fi.FBP ==0x03800 && fi.TBP0 && fi.TPSM ==0 && fi.FBMSK == 0)
{
skip = 1; //重影
skip = 1;
}
/*else if(fi.TPSM ==0x00000 && PSM_PSMCT24 && fi.TME && fi.FBP == 0x03800)
{
skip = 1 ; // 光源
skip = 1 ;
}*/
/*else if(fi.TME ==0 && (fi.FBP ==0 ) && fi.FPSM == PSM_PSMCT32 && ( fi.TPSM == PSM_PSMT8 || fi.TPSM == PSM_PSMT4) && (fi.FBMSK == 0x00FFFFFF || fi.FBMSK == 0xFF000000))
{
skip = 1; //去黑暗
skip = 1;
}*/
else
{
@ -4749,15 +4748,15 @@ bool GSC_SakuraWarsSoLongMyLove(const GSFrameInfo& fi, int& skip)
{
if(fi.TME==0 && fi.FBP != fi.TBP0 && fi.TBP0 && fi.FBMSK == 0x00FFFFFF)
{
skip = 3; //去黑暗
skip = 3;
}
else if(fi.TME==0 && fi.FBP == fi.TBP0 && (fi.TBP0 ==0x1200 ||fi.TBP0 ==0x1180 ||fi.TBP0 ==0) && fi.FBMSK == 0x00FFFFFF)
{
skip = 3; //去黑暗
skip = 3;
}
else if(fi.TME && (fi.FBP ==0 || fi.FBP ==0x1180) && fi.FPSM == PSM_PSMCT32 && fi.TBP0 ==0x3F3F && fi.TPSM == PSM_PSMT8)
{
skip = 1; //機甲泛光
skip = 1;
}
}
@ -4771,7 +4770,7 @@ bool GSC_FightingBeautyWulong(const GSFrameInfo& fi, int& skip)
if(fi.TME && (fi.TBP0 ==0x0700 || fi.TBP0 ==0x0a80) && (fi.TPSM == PSM_PSMCT32 || fi.TPSM == PSM_PSMCT24))
{
skip = 1;
} //消除模糊
}
}
return true;
@ -4800,7 +4799,7 @@ bool GSC_GTASanAndreas(const GSFrameInfo& fi, int& skip)
{
if(fi.TME && (fi.FBP ==0x0a00 || fi.FBP ==0x08c0) && (fi.TBP0 ==0x1b80 || fi.TBP0 ==0x1a40) && fi.FPSM == fi.TPSM && fi.TPSM == PSM_PSMCT32)
{
skip = 1; // 重影跟水波紋
skip = 1;
}
}
@ -4813,11 +4812,11 @@ bool GSC_FrontMission5(const GSFrameInfo& fi, int& skip)
{
if(fi.TPSM == PSM_PSMT8H && fi.FBMSK == 0)
{
skip = 1; //動畫
skip = 1;
}
if(fi.TME && (fi.FBP ==0x1000) && (fi.TBP0 ==0x2e00 || fi.TBP0 ==0x3200) && fi.FPSM == fi.TPSM && fi.TPSM == PSM_PSMCT32)
{
skip = 1; //影子fi.TBP0 ==0x1f00
skip = 1; //fi.TBP0 ==0x1f00
}
}
@ -4830,7 +4829,7 @@ bool GSC_GodHand(const GSFrameInfo& fi, int& skip)
{
if(fi.TME && (fi.FBP ==0x0) && (fi.TBP0 ==0x2800) && fi.FPSM == fi.TPSM && fi.TPSM == PSM_PSMCT32)
{
skip = 1; // 模糊
skip = 1;
}
}
@ -4843,11 +4842,11 @@ bool GSC_KnightsOfTheTemple2(const GSFrameInfo& fi, int& skip)
{
if(fi.TPSM == PSM_PSMT8H && fi.FBMSK == 0)
{
skip = 1; //重影
skip = 1;
}
else if(fi.TPSM ==0x00000 && PSM_PSMCT24 && fi.TME && (fi.FBP ==0x3400 ||fi.FBP==0x3a00))
{
skip = 1 ; //光源
skip = 1 ;
}
}
@ -4860,7 +4859,7 @@ bool GSC_UltramanFightingEvolution(const GSFrameInfo& fi, int& skip)
{
if(fi.TME && fi.FBP==0x2a00 && fi.FPSM == PSM_PSMZ24 && fi.TBP0 == 0x1c00 && fi.TPSM == PSM_PSMZ24)
{
skip = 5; // blur 不損光源
skip = 5; // blur
}
}
@ -4873,18 +4872,18 @@ bool GSC_DeathByDegreesTekkenNinaWilliams(const GSFrameInfo& fi, int& skip)
{
if(fi.TME && (fi.FBP ==0 ) && fi.TBP0==0x34a0 && (fi.TPSM == PSM_PSMCT32))
{
skip = 1; //去動畫窗格
skip = 1;
}
else if((fi.FBP ==0x3500)&& fi.TPSM == PSM_PSMT8 && fi.FBMSK == 0xFFFF00FF)
{
skip = 4; //水下白霧
skip = 4;
}
}
if(fi.TME)
{
if((fi.FBP | fi.TBP0 | fi.FPSM | fi.TPSM) && (fi.FBMSK == 0x00FFFFFF ))
{
skip = 1; //動畫速度
skip = 1;
}
}
return true;
@ -4896,7 +4895,7 @@ bool GSC_AlpineRacer3(const GSFrameInfo& fi, int& skip)
{
if(!fi.TME && fi.FBP == 0 && fi.TBP0>=0 && (fi.TPSM >= 0 ) && (fi.FBMSK ==0x0001 ||fi.FBMSK == 0x00FFFFFF))
{
skip = 2; //去黑暗
skip = 2;
}
}
@ -4909,7 +4908,7 @@ bool GSC_HummerBadlands(const GSFrameInfo& fi, int& skip)
{
if(fi.TME && (fi.FBP ==0x0a00) && (fi.TBP0 ==0x03200 || fi.TBP0==0x3700) && fi.FPSM == fi.TPSM && fi.TPSM == PSM_PSMCT32)
{
skip = 1; //影子
skip = 1;
}
}
@ -4922,7 +4921,7 @@ bool GSC_SengokuBasara(const GSFrameInfo& fi, int& skip)
{
if(fi.TME && (fi.TBP0==0x1800 ) && fi.FBMSK==0xFF000000)
{
skip = 1; //霧
skip = 1;
}
}
@ -4935,7 +4934,7 @@ bool GSC_Grandia3(const GSFrameInfo& fi, int& skip)
{
if(fi.TME && (fi.FBP ==0x0 || fi.FBP ==0x0e00) && (fi.TBP0 ==0x2a00 ||fi.TBP0==0x0e00 ||fi.TBP0==0) && fi.FPSM == fi.TPSM && fi.TPSM == PSM_PSMCT32)
{
skip = 1; // 模糊
skip = 1;
}
}
@ -4962,11 +4961,11 @@ bool GSC_TalesofSymphonia(const GSFrameInfo& fi, int& skip)
{
if(fi.TME && (fi.FBP >= 0) && fi.FPSM == PSM_PSMCT32 && (fi.TBP0 == 0x2bc0 || fi.TBP0 <= 0x0200) && (fi.FBMSK==0xFF000000 ||fi.FBMSK==0x00FFFFFF))
{
skip = 1; //fi.FBMSK==0造成動畫黑屏,加速戰鬥速度
skip = 1; //fi.FBMSK==0
}
if(fi.TME && (fi.TBP0==0x1180 || fi.TBP0==0x1a40 || fi.TBP0==0x2300) && fi.FBMSK>=0xFF000000)
{
skip = 1; //過場殘影
skip = 1;
}
}
@ -5017,11 +5016,11 @@ bool GSC_Simple2000Vol114(const GSFrameInfo& fi, int& skip)
{
if(fi.TME==0 && (fi.FBP==0x1500) && (fi.TBP0==0x2c97 || fi.TBP0==0x2ace || fi.TBP0==0x03d0 || fi.TBP0==0x2448) && (fi.FBMSK == 0x0000))
{
skip = 1; //去影子
skip = 1;
}
if(fi.TME && (fi.FBP==0x0e00) && (fi.TBP0==0x1000) && (fi.FBMSK == 0x0000))
{
skip = 1; //去迷霧
skip = 1;
}
}
return true;
@ -5032,7 +5031,7 @@ bool GSC_UrbanReign(const GSFrameInfo& fi, int& skip)
{
if(fi.TME && fi.FBP==0x0000 && fi.TBP0==0x3980 && fi.FPSM==fi.TPSM && fi.TPSM == PSM_PSMCT32 && fi.TPSM ==0 && fi.FBMSK == 0x0)
{
skip = 1; //黑影
skip = 1;
}
}
return true;