zzogl-pg: More changes to the new register code.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3444 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2010-07-10 06:04:32 +00:00
parent dd100a775e
commit f07f522238
9 changed files with 164 additions and 179 deletions

View File

@ -635,6 +635,7 @@ typedef struct
int imageWnew, imageHnew, imageX, imageY, imageEndX, imageEndY; int imageWnew, imageHnew, imageX, imageY, imageEndX, imageEndY;
pathInfo path[3]; pathInfo path[3];
GIFRegDIMX dimx;
void setRGBA(u32 r, u32 g, u32 b, u32 a) void setRGBA(u32 r, u32 g, u32 b, u32 a)
{ {
rgba = (r & 0xff) | rgba = (r & 0xff) |
@ -642,7 +643,25 @@ typedef struct
((b & 0xff) << 16) | ((b & 0xff) << 16) |
((a & 0xff) << 24); ((a & 0xff) << 24);
} }
void add_vertex(u16 x, u16 y, u32 z, float f)
{
vertexregs.x = x;
vertexregs.y = y;
vertexregs.z = z;
vertexregs.f = f;
gsvertex[primIndex] = vertexregs;
primIndex = (primIndex + 1) % ARRAY_SIZE(gsvertex);
}
void add_vertex(u16 x, u16 y, u32 z)
{
vertexregs.x = x;
vertexregs.y = y;
vertexregs.z = z;
gsvertex[primIndex] = vertexregs;
primIndex = (primIndex + 1) % ARRAY_SIZE(gsvertex);
}
} GSinternal; } GSinternal;
extern GSinternal gs; extern GSinternal gs;

View File

@ -140,13 +140,7 @@ void __fastcall GIFPackedRegHandlerXYZF2(u32* data)
{ {
FUNCLOG FUNCLOG
GIFPackedXYZF2* r = (GIFPackedXYZF2*)(data); GIFPackedXYZF2* r = (GIFPackedXYZF2*)(data);
gs.vertexregs.x = r->X; gs.add_vertex(r->X, r->Y,r->Z, r->F);
gs.vertexregs.y = r->Y;
gs.vertexregs.z = r->Z;
gs.vertexregs.f = r->F;
gs.gsvertex[gs.primIndex] = gs.vertexregs;
gs.primIndex = (gs.primIndex + 1) % ArraySize(gs.gsvertex);
// Fix Vertexes up later. // Fix Vertexes up later.
if (data[3] & 0x8000) if (data[3] & 0x8000)
@ -163,11 +157,7 @@ void __fastcall GIFPackedRegHandlerXYZ2(u32* data)
{ {
FUNCLOG FUNCLOG
GIFPackedXYZ2* r = (GIFPackedXYZ2*)(data); GIFPackedXYZ2* r = (GIFPackedXYZ2*)(data);
gs.vertexregs.x = r->X; gs.add_vertex(r->X, r->Y,r->Z);
gs.vertexregs.y = r->Y;
gs.vertexregs.z = r->Z;
gs.gsvertex[gs.primIndex] = gs.vertexregs;
gs.primIndex = (gs.primIndex + 1) % ArraySize(gs.gsvertex);
// Fix Vertexes up later. // Fix Vertexes up later.
if (data[3] & 0x8000) if (data[3] & 0x8000)
@ -203,6 +193,7 @@ void __fastcall GIFPackedRegHandlerNOP(u32* data)
void tex0Write(int i, u32 *data) void tex0Write(int i, u32 *data)
{ {
FUNCLOG FUNCLOG
GIFRegTEX0* r = (GIFRegTEX0*)(data);
u32 psm = ZZOglGet_psm_TexBitsFix(data[0]); u32 psm = ZZOglGet_psm_TexBitsFix(data[0]);
if (m_Blocks[psm].bpp == 0) if (m_Blocks[psm].bpp == 0)
@ -211,7 +202,10 @@ void tex0Write(int i, u32 *data)
return; return;
} }
ZeroGS::vb[i].uNextTex0Data[0] = data[0]; //ZeroGS::vb[i].uCurTex0.i64 = r->i64;
// ZeroGS::vb[i].uNextTex0Data[0] = r->ai32[0];
// ZeroGS::vb[i].uNextTex0Data[1] = r->ai32[1];
ZeroGS::vb[i].uNextTex0Data[0] = data[0];
ZeroGS::vb[i].uNextTex0Data[1] = data[1]; ZeroGS::vb[i].uNextTex0Data[1] = data[1];
ZeroGS::vb[i].bNeedTexCheck = 1; ZeroGS::vb[i].bNeedTexCheck = 1;
@ -224,10 +218,10 @@ void tex0Write(int i, u32 *data)
// loading clut, so flush whole texture // loading clut, so flush whole texture
ZeroGS::vb[i].FlushTexData(); ZeroGS::vb[i].FlushTexData();
} }
// else if (r->CSA != (ZeroGS::vb[i].uCurTex0.CSA))
// check if csa is the same!! (ffx bisaid island, grass)
else if ((data[1] & 0x1f780000) != (ZeroGS::vb[i].uCurTex0Data[1] & 0x1f780000)) else if ((data[1] & 0x1f780000) != (ZeroGS::vb[i].uCurTex0Data[1] & 0x1f780000))
{ {
// check if csa is the same!! (ffx bisaid island, grass)
ZeroGS::Flush(i); // flush any previous entries ZeroGS::Flush(i); // flush any previous entries
} }
} }
@ -238,7 +232,7 @@ void tex2Write(int i, u32 *data)
FUNCLOG FUNCLOG
tex0Info& tex0 = ZeroGS::vb[i].tex0; tex0Info& tex0 = ZeroGS::vb[i].tex0;
if (ZeroGS::vb[i].bNeedTexCheck) ZeroGS::vb[i].FlushTexData(); ZeroGS::vb[i].FlushTexData();
u32 psm = ZZOglGet_psm_TexBitsFix(data[0]); u32 psm = ZZOglGet_psm_TexBitsFix(data[0]);
@ -310,22 +304,12 @@ __forceinline void testWrite(int i, u32 *data)
pixTest* test = &ZeroGS::vb[i].test; pixTest* test = &ZeroGS::vb[i].test;
GIFRegTEST* r = (GIFRegTEST*)(data); GIFRegTEST* r = (GIFRegTEST*)(data);
if ((*(u32*)test & 0x0007ffff) == (data[0] & 0x0007ffff)) return;
if (test->_val != r->ai32[0]) if (test->_val != r->ai32[0])
{ {
ZeroGS::Flush(i); ZeroGS::Flush(i);
} }
//test = (pixTest*)data;
test->_val = r->ai32[0]; test->_val = r->ai32[0];
// test->ate = r->ATE;
// test->atst = r->ATST;
// test->aref = r->AREF;
// test->afail = r->AFAIL;
// test->date = r->DATE;
// test->datm = r->DATM;
// test->zte = r->ZTE;
} }
void clampWrite(int i, u32 *data) void clampWrite(int i, u32 *data)
@ -337,17 +321,18 @@ void clampWrite(int i, u32 *data)
if ((s_uClampData[i] != data[0]) || (((clamp.minv >> 8) | (clamp.maxv << 2)) != (data[1]&0x0fff))) if ((s_uClampData[i] != data[0]) || (((clamp.minv >> 8) | (clamp.maxv << 2)) != (data[1]&0x0fff)))
{ {
ZeroGS::Flush(i); ZeroGS::Flush(i);
s_uClampData[i] = data[0];
clamp.wms = r->WMS;
clamp.wmt = r->WMT;
clamp.minu = r->MINU;
clamp.maxu = r->MAXU;
clamp.minv = r->MINV;
clamp.maxv = r->MAXV;
ZeroGS::vb[i].bTexConstsSync = false; ZeroGS::vb[i].bTexConstsSync = false;
} }
s_uClampData[i] = data[0];
clamp.wms = r->WMS;
clamp.wmt = r->WMT;
clamp.minu = r->MINU;
clamp.maxu = r->MAXU;
clamp.minv = r->MINV;
clamp.maxv = r->MAXV;
} }
void __fastcall GIFRegHandlerNull(u32* data) void __fastcall GIFRegHandlerNull(u32* data)
@ -406,6 +391,7 @@ void __fastcall GIFRegHandlerST(u32* data)
void __fastcall GIFRegHandlerUV(u32* data) void __fastcall GIFRegHandlerUV(u32* data)
{ {
// Baroque breaks if u&v are 16 bits instead of 14.
FUNCLOG FUNCLOG
GIFRegUV* r = (GIFRegUV*)(data); GIFRegUV* r = (GIFRegUV*)(data);
gs.vertexregs.u = r->U; gs.vertexregs.u = r->U;
@ -416,12 +402,7 @@ void __fastcall GIFRegHandlerXYZF2(u32* data)
{ {
FUNCLOG FUNCLOG
GIFRegXYZF* r = (GIFRegXYZF*)(data); GIFRegXYZF* r = (GIFRegXYZF*)(data);
gs.vertexregs.x = r->X; gs.add_vertex(r->X, r->Y,r->Z, r->F);
gs.vertexregs.y = r->Y;
gs.vertexregs.z = r->Z;
gs.vertexregs.f = r->F;
gs.gsvertex[gs.primIndex] = gs.vertexregs;
gs.primIndex = (gs.primIndex + 1) % ARRAY_SIZE(gs.gsvertex);
KICK_VERTEX2(); KICK_VERTEX2();
} }
@ -430,11 +411,7 @@ void __fastcall GIFRegHandlerXYZ2(u32* data)
{ {
FUNCLOG FUNCLOG
GIFRegXYZ* r = (GIFRegXYZ*)(data); GIFRegXYZ* r = (GIFRegXYZ*)(data);
gs.vertexregs.x = r->X; gs.add_vertex(r->X, r->Y,r->Z);
gs.vertexregs.y = r->Y;
gs.vertexregs.z = r->Z;
gs.gsvertex[gs.primIndex] = gs.vertexregs;
gs.primIndex = (gs.primIndex + 1) % ARRAY_SIZE(gs.gsvertex);
KICK_VERTEX2(); KICK_VERTEX2();
} }
@ -490,12 +467,7 @@ void __fastcall GIFRegHandlerXYZF3(u32* data)
{ {
FUNCLOG FUNCLOG
GIFRegXYZF* r = (GIFRegXYZF*)(data); GIFRegXYZF* r = (GIFRegXYZF*)(data);
gs.vertexregs.x = r->X; gs.add_vertex(r->X, r->Y,r->Z, r->F);
gs.vertexregs.y = r->Y;
gs.vertexregs.z = r->Z;
gs.vertexregs.f = r->F;
gs.gsvertex[gs.primIndex] = gs.vertexregs;
gs.primIndex = (gs.primIndex + 1) % ARRAY_SIZE(gs.gsvertex);
KICK_VERTEX3(); KICK_VERTEX3();
} }
@ -504,11 +476,7 @@ void __fastcall GIFRegHandlerXYZ3(u32* data)
{ {
FUNCLOG FUNCLOG
GIFRegXYZ* r = (GIFRegXYZ*)(data); GIFRegXYZ* r = (GIFRegXYZ*)(data);
gs.vertexregs.x = r->X; gs.add_vertex(r->X, r->Y,r->Z);
gs.vertexregs.y = r->Y;
gs.vertexregs.z = r->Z;
gs.gsvertex[gs.primIndex] = gs.vertexregs;
gs.primIndex = (gs.primIndex + 1) % ARRAY_SIZE(gs.gsvertex);
KICK_VERTEX3(); KICK_VERTEX3();
} }
@ -613,8 +581,8 @@ void __fastcall GIFRegHandlerTEXCLUT(u32* data)
FUNCLOG FUNCLOG
GIFRegTEXCLUT* r = (GIFRegTEXCLUT*)(data); GIFRegTEXCLUT* r = (GIFRegTEXCLUT*)(data);
if (ZeroGS::vb[0].bNeedTexCheck) ZeroGS::vb[0].FlushTexData(); ZeroGS::vb[0].FlushTexData();
if (ZeroGS::vb[1].bNeedTexCheck) ZeroGS::vb[1].FlushTexData(); ZeroGS::vb[1].FlushTexData();
// Fixme. // Fixme.
gs.clut.cbw = r->CBW << 6; gs.clut.cbw = r->CBW << 6;
@ -760,10 +728,11 @@ void __fastcall GIFRegHandlerSCISSOR_1(u32* data)
newscissor.x0 != scissor.x0 || newscissor.y0 != scissor.y0) newscissor.x0 != scissor.x0 || newscissor.y0 != scissor.y0)
{ {
ZeroGS::Flush(0); ZeroGS::Flush(0);
scissor = newscissor;
ZeroGS::vb[0].bNeedFrameCheck = 1; ZeroGS::vb[0].bNeedFrameCheck = 1;
} }
scissor = newscissor;
//Hmm... //Hmm...
/* /*
if(PRIM->CTXT == i && r->SCISSOR != m_env.CTXT[i].SCISSOR) if(PRIM->CTXT == i && r->SCISSOR != m_env.CTXT[i].SCISSOR)
@ -794,86 +763,96 @@ void __fastcall GIFRegHandlerSCISSOR_2(u32* data)
newscissor.x0 != scissor.x0 || newscissor.y0 != scissor.y0) newscissor.x0 != scissor.x0 || newscissor.y0 != scissor.y0)
{ {
ZeroGS::Flush(1); ZeroGS::Flush(1);
scissor = newscissor;
// flush everything // flush everything
ZeroGS::vb[1].bNeedFrameCheck = 1; ZeroGS::vb[1].bNeedFrameCheck = 1;
} }
scissor = newscissor;
} }
void __fastcall GIFRegHandlerALPHA_1(u32* data) void __fastcall GIFRegHandlerALPHA_1(u32* data)
{ {
FUNCLOG FUNCLOG
// Another tangled one. Mess with this later.
GIFRegALPHA* r = (GIFRegALPHA*)(data);
alphaInfo newalpha; alphaInfo newalpha;
newalpha.abcd = *(u8*)data;
newalpha.fix = *(u8*)(data + 1); newalpha.a = r->A;
newalpha.b = r->B;
if (*(u16*)&newalpha != *(u16*)&ZeroGS::vb[0].alpha) newalpha.c = r->C;
newalpha.d = r->D;
newalpha.fix = r->FIX;
if (newalpha.a == 3) newalpha.a = 0;
if (newalpha.b == 3) newalpha.b = 0;
if (newalpha.c == 3) newalpha.c = 0;
if (newalpha.d == 3) newalpha.d = 0;
if ((newalpha.abcd != ZeroGS::vb[0].alpha.abcd) || (newalpha.fix != ZeroGS::vb[0].alpha.fix))
{ {
ZeroGS::Flush(0); ZeroGS::Flush(0);
if (newalpha.a == 3) newalpha.a = 0;
if (newalpha.b == 3) newalpha.b = 0;
if (newalpha.c == 3) newalpha.c = 0;
if (newalpha.d == 3) newalpha.d = 0;
*(u16*)&ZeroGS::vb[0].alpha = *(u16*) & newalpha;
} }
ZeroGS::vb[0].alpha = newalpha;
} }
void __fastcall GIFRegHandlerALPHA_2(u32* data) void __fastcall GIFRegHandlerALPHA_2(u32* data)
{ {
FUNCLOG FUNCLOG
// ... GIFRegALPHA* r = (GIFRegALPHA*)(data);
alphaInfo newalpha; alphaInfo newalpha;
newalpha.abcd = *(u8*)data;
newalpha.fix = *(u8*)(data + 1); newalpha.a = r->A;
newalpha.b = r->B;
newalpha.c = r->C;
newalpha.d = r->D;
newalpha.fix = r->FIX;
if (*(u16*)&newalpha != *(u16*)&ZeroGS::vb[1].alpha) if (newalpha.a == 3) newalpha.a = 0;
if (newalpha.b == 3) newalpha.b = 0;
if (newalpha.c == 3) newalpha.c = 0;
if (newalpha.d == 3) newalpha.d = 0;
if ((newalpha.abcd != ZeroGS::vb[1].alpha.abcd) || (newalpha.fix != ZeroGS::vb[1].alpha.fix))
{ {
ZeroGS::Flush(1); ZeroGS::Flush(1);
if (newalpha.a == 3) newalpha.a = 0;
if (newalpha.b == 3) newalpha.b = 0;
if (newalpha.c == 3) newalpha.c = 0;
if (newalpha.d == 3) newalpha.d = 0;
*(u16*)&ZeroGS::vb[1].alpha = *(u16*) & newalpha;
} }
ZeroGS::vb[1].alpha = newalpha;
} }
void __fastcall GIFRegHandlerDIMX(u32* data) void __fastcall GIFRegHandlerDIMX(u32* data)
{ {
FUNCLOG FUNCLOG
GIFRegDIMX* r = (GIFRegDIMX*)(data);
// Not even handled? Fixme. // Not even handled? Fixme.
/*
bool update = false; bool update = false;
if(r->DIMX != m_env.DIMX) if (r->i64 != gs.dimx.i64)
{ {
Flush(); ZeroGS::FlushBoth();
update = true; update = true;
} }
m_env.DIMX = (GSVector4i)r->DIMX; gs.dimx.i64 = r->i64;
if(update) if (update)
{ {
m_env.UpdateDIMX(); //gs.UpdateDIMX();
}*/ }
} }
void __fastcall GIFRegHandlerDTHE(u32* data) void __fastcall GIFRegHandlerDTHE(u32* data)
{ {
FUNCLOG FUNCLOG
GIFRegDTHE* r = (GIFRegDTHE*)(data); GIFRegDTHE* r = (GIFRegDTHE*)(data);
// Flush me.
if (r->DTHE != gs.dthe) if (r->DTHE != gs.dthe)
{ {
ZeroGS::FlushBoth(); ZeroGS::FlushBoth();
} }
gs.dthe = r->DTHE; gs.dthe = r->DTHE;
} }
@ -886,6 +865,7 @@ void __fastcall GIFRegHandlerCOLCLAMP(u32* data)
{ {
ZeroGS::FlushBoth(); ZeroGS::FlushBoth();
} }
gs.colclamp = r->CLAMP; gs.colclamp = r->CLAMP;
} }
@ -905,11 +885,12 @@ void __fastcall GIFRegHandlerPABE(u32* data)
{ {
FUNCLOG FUNCLOG
GIFRegPABE* r = (GIFRegPABE*)(data); GIFRegPABE* r = (GIFRegPABE*)(data);
//ZeroGS::SetAlphaChanged(0, GPUREG_PABE);
//ZeroGS::SetAlphaChanged(1, GPUREG_PABE);
if (gs.pabe != r->PABE) if (gs.pabe != r->PABE)
{ {
ZeroGS::FlushBoth(); ZeroGS::FlushBoth();
// ZeroGS::SetAlphaChanged(0, GPUREG_PABE);
// ZeroGS::SetAlphaChanged(1, GPUREG_PABE);
} }
gs.pabe = r->PABE; gs.pabe = r->PABE;
@ -924,6 +905,7 @@ void __fastcall GIFRegHandlerFBA_1(u32* data)
{ {
ZeroGS::FlushBoth(); ZeroGS::FlushBoth();
} }
ZeroGS::vb[0].fba.fba = r->FBA; ZeroGS::vb[0].fba.fba = r->FBA;
} }
@ -1052,9 +1034,6 @@ void __fastcall GIFRegHandlerTRXPOS(u32* data)
gs.trxposnew.sy = r->SSAY; gs.trxposnew.sy = r->SSAY;
gs.trxposnew.dx = r->DSAX; gs.trxposnew.dx = r->DSAX;
gs.trxposnew.dy = r->DSAY; gs.trxposnew.dy = r->DSAY;
//Fixme. DIRY & DIRX together?
//gs.trxposnew.dir = (data[1] >> 27) & 0x3;
gs.trxposnew.dirx = r->DIRX; gs.trxposnew.dirx = r->DIRX;
gs.trxposnew.diry = r->DIRY; gs.trxposnew.diry = r->DIRY;
} }
@ -1153,14 +1132,9 @@ void __fastcall GIFRegHandlerSIGNAL(u32* data)
{ {
SIGLBLID->SIGID = (SIGLBLID->SIGID & ~data[1]) | (data[0] & data[1]); SIGLBLID->SIGID = (SIGLBLID->SIGID & ~data[1]) | (data[0] & data[1]);
// if (gs.CSRw & 0x1) CSR->SIGNAL = 1;
// if (!IMR->SIGMSK && GSirq)
// GSirq();
if (gs.CSRw & 0x1) if (gs.CSRw & 0x1)
{ {
CSR->SIGNAL = 1; CSR->SIGNAL = 1;
//gs.CSRw &= ~1;
} }
if (!IMR->SIGMSK && GSirq) GSirq(); if (!IMR->SIGMSK && GSirq) GSirq();
@ -1176,17 +1150,6 @@ void __fastcall GIFRegHandlerFINISH(u32* data)
if (gs.CSRw & 0x2) CSR->FINISH = 1; if (gs.CSRw & 0x2) CSR->FINISH = 1;
if (!IMR->FINISHMSK && GSirq) GSirq(); if (!IMR->FINISHMSK && GSirq) GSirq();
// if( gs.CSRw & 2 ) {
// //gs.CSRw &= ~2;
// //CSR->FINISH = 0;
//
//
// }
// CSR->FINISH = 1;
//
// if( !IMR->FINISHMSK && GSirq )
// GSirq();
} }
} }

View File

@ -575,21 +575,19 @@ REG64_(GIFReg, TRXREG)
u32 _PAD2:20; u32 _PAD2:20;
REG_END REG_END
// GSState::GIFPackedRegHandlerUV and GSState::GIFRegHandlerUV will make sure that the _PAD1/2 bits are set to zero
REG64_(GIFReg, UV) REG64_(GIFReg, UV)
u32 U:16; u32 U:14;
// u32 _PAD1:2; u32 _PAD1:2;
u32 V:16; u32 V:14;
// u32 _PAD2:2; u32 _PAD2:2;
u32 _PAD3:32; u32 _PAD3:32;
REG_END REG_END
// GSState::GIFRegHandlerXYOFFSET will make sure that the _PAD1/2 bits are set to zero
REG64_(GIFReg, XYOFFSET) REG64_(GIFReg, XYOFFSET)
u32 OFX; // :16; u32 _PAD1:16; u32 OFX:16;
u32 OFY; // :16; u32 _PAD2:16; u32 _PAD1:16;
u32 OFY:16;
u32 _PAD2:16;
REG_END REG_END
REG64_(GIFReg, XYZ) REG64_(GIFReg, XYZ)

View File

@ -256,7 +256,7 @@ void tex2Write(int i, u32 *data)
FUNCLOG FUNCLOG
tex0Info& tex0 = ZeroGS::vb[i].tex0; tex0Info& tex0 = ZeroGS::vb[i].tex0;
if (ZeroGS::vb[i].bNeedTexCheck) ZeroGS::vb[i].FlushTexData(); ZeroGS::vb[i].FlushTexData();
u32 psm = ZZOglGet_psm_TexBitsFix(data[0]); u32 psm = ZZOglGet_psm_TexBitsFix(data[0]);
@ -621,8 +621,8 @@ void __fastcall GIFRegHandlerTEXCLUT(u32* data)
{ {
FUNCLOG FUNCLOG
if (ZeroGS::vb[0].bNeedTexCheck) ZeroGS::vb[0].FlushTexData(); ZeroGS::vb[0].FlushTexData();
if (ZeroGS::vb[1].bNeedTexCheck) ZeroGS::vb[1].FlushTexData(); ZeroGS::vb[1].FlushTexData();
gs.clut.cbw = ((data[0]) & 0x3f) * 64; gs.clut.cbw = ((data[0]) & 0x3f) * 64;
gs.clut.cou = ((data[0] >> 6) & 0x3f) * 16; gs.clut.cou = ((data[0] >> 6) & 0x3f) * 16;

View File

@ -163,9 +163,8 @@ static Vector vAlphaBlendColor; // used for GPU_COLOR
static bool bNeedBlendFactorInAlpha; // set if the output source alpha is different from the real source alpha (only when blend factor > 0x80) static bool bNeedBlendFactorInAlpha; // set if the output source alpha is different from the real source alpha (only when blend factor > 0x80)
static u32 s_dwColorWrite = 0xf; // the color write mask of the current target static u32 s_dwColorWrite = 0xf; // the color write mask of the current target
union typedef union
{ {
struct struct
{ {
u8 _bNeedAlphaColor; // set if vAlphaBlendColor needs to be set u8 _bNeedAlphaColor; // set if vAlphaBlendColor needs to be set
@ -176,7 +175,9 @@ union
}; };
u32 _bAlphaState; u32 _bAlphaState;
} g_vars; } g_flag_vars;
g_flag_vars g_vars;
//#define bNeedAlphaColor g_vars._bNeedAlphaColor //#define bNeedAlphaColor g_vars._bNeedAlphaColor
#define b2XAlphaTest g_vars._b2XAlphaTest #define b2XAlphaTest g_vars._b2XAlphaTest
@ -399,7 +400,7 @@ inline void FlushTransferRangesHelper(VB& curvb)
} }
} }
// If set bit for texture cheking, do it. Maybe it's all. // If set bit for texture checking, do it. Maybe it's all.
inline bool FushTexDataHelper(VB& curvb) inline bool FushTexDataHelper(VB& curvb)
{ {
if (curvb.bNeedFrameCheck || curvb.bNeedZCheck) if (curvb.bNeedFrameCheck || curvb.bNeedZCheck)

View File

@ -124,6 +124,8 @@ void SetupFragmentProgramParameters(FRAGMENTSHADER* pf, int context, int type)
pf->set_shader_const(Vector(1 / 1024.0f, 0.2f / 1024.0f, 1 / 128.0f, 1 / 512.0f), "g_fMult"); pf->set_shader_const(Vector(1 / 1024.0f, 0.2f / 1024.0f, 1 / 128.0f, 1 / 512.0f), "g_fMult");
} }
static bool outdated_shaders = false;
void SetupVertexProgramParameters(CGprogram prog, int context) void SetupVertexProgramParameters(CGprogram prog, int context)
{ {
CGparameter p; CGparameter p;
@ -160,7 +162,11 @@ void SetupVertexProgramParameters(CGprogram prog, int context)
} }
else else
{ {
ZZLog::Error_Log("Shader file version is outdated! Only log-Z is possible."); if (!outdated_shaders)
{
outdated_shaders = true;
ZZLog::Error_Log("Shader file version is outdated! Only log-Z is possible.");
}
} }
} }

View File

@ -457,44 +457,47 @@ void ZeroGS::VB::FlushTexData()
{ {
GL_REPORT_ERRORD(); GL_REPORT_ERRORD();
assert(bNeedTexCheck); //assert(bNeedTexCheck);
bNeedTexCheck = 0; //if (bNeedTexCheck)
u32 psm = ZZOglGet_psm_TexBitsFix(uNextTex0Data[0]);
// don't update unless necessary
if (ZZOglAllExceptClutIsSame(uCurTex0Data, uNextTex0Data))
{ {
// Don't need to do anything if there is no clutting and VB tex data was not changed bNeedTexCheck = 0;
if (!PSMT_ISCLUT(psm)) return;
// have to write the CLUT again if only CLD was changed u32 psm = ZZOglGet_psm_TexBitsFix(uNextTex0Data[0]);
if (ZZOglClutMinusCLDunchanged(uCurTex0Data, uNextTex0Data))
// don't update unless necessary
if (ZZOglAllExceptClutIsSame(uCurTex0Data, uNextTex0Data))
{ {
FlushTexUnchangedClutDontUpdate(); // Don't need to do anything if there is no clutting and VB tex data was not changed
return; if (!PSMT_ISCLUT(psm)) return;
// have to write the CLUT again if only CLD was changed
if (ZZOglClutMinusCLDunchanged(uCurTex0Data, uNextTex0Data))
{
FlushTexUnchangedClutDontUpdate();
return;
}
// Cld bit is 0 means that clut buffer stay unchanged
if (ZZOglGet_cld_TexBits(uNextTex0Data[1]) == 0)
{
FlushTexClutDontUpdate();
return;
}
} }
// Cld bit is 0 means that clut buffer stay unchanged // Made the full update
if (ZZOglGet_cld_TexBits(uNextTex0Data[1]) == 0) ZeroGS::Flush(ictx);
{
FlushTexClutDontUpdate(); bVarsTexSync = false;
return; bTexConstsSync = false;
}
uCurTex0Data[0] = uNextTex0Data[0];
uCurTex0Data[1] = uNextTex0Data[1];
FlushTexSetNewVars(psm);
if (PSMT_ISCLUT(psm)) ZeroGS::CluttingForFlushedTex(&tex0, uNextTex0Data[1], ictx) ;
GL_REPORT_ERRORD();
} }
// Made the full update
ZeroGS::Flush(ictx);
bVarsTexSync = false;
bTexConstsSync = false;
uCurTex0Data[0] = uNextTex0Data[0];
uCurTex0Data[1] = uNextTex0Data[1];
FlushTexSetNewVars(psm);
if (PSMT_ISCLUT(psm)) ZeroGS::CluttingForFlushedTex(&tex0, uNextTex0Data[1], ictx) ;
GL_REPORT_ERRORD();
} }

View File

@ -619,15 +619,6 @@ void SET_VERTEX(VertexGPU *p, int Index, const VB& curvb)
int index = Index; int index = Index;
p->x = ((((int)gs.gsvertex[index].x - curvb.offset.x) >> 1) & 0xffff); p->x = ((((int)gs.gsvertex[index].x - curvb.offset.x) >> 1) & 0xffff);
p->y = ((((int)gs.gsvertex[index].y - curvb.offset.y) >> 1) & 0xffff); p->y = ((((int)gs.gsvertex[index].y - curvb.offset.y) >> 1) & 0xffff);
#ifdef LSD_MODE
int diffX = (int)gs.gsvertex[index].x - curvb.offset.x;
int diffY = (int)gs.gsvertex[index].y - curvb.offset.y;
if (diffX < 0) { p->x = - p->x; }
if (diffY < 0) { p->y = - p->y; }
#endif
p->f = ((s16)gs.gsvertex[index].f << 7) | 0x7f; p->f = ((s16)gs.gsvertex[index].f << 7) | 0x7f;
MOVZ(p, gs.gsvertex[index].z, curvb); MOVZ(p, gs.gsvertex[index].z, curvb);
@ -678,7 +669,7 @@ void ZeroGS::KickPoint()
VB& curvb = vb[prim->ctxt]; VB& curvb = vb[prim->ctxt];
if (curvb.bNeedTexCheck) curvb.FlushTexData(); curvb.FlushTexData();
if ((vb[!prim->ctxt].nCount > 0) && (vb[prim->ctxt].gsfb.fbp == vb[!prim->ctxt].gsfb.fbp)) if ((vb[!prim->ctxt].nCount > 0) && (vb[prim->ctxt].gsfb.fbp == vb[!prim->ctxt].gsfb.fbp))
{ {
@ -703,7 +694,7 @@ void ZeroGS::KickLine()
assert(gs.primC >= 2); assert(gs.primC >= 2);
VB& curvb = vb[prim->ctxt]; VB& curvb = vb[prim->ctxt];
if (curvb.bNeedTexCheck) curvb.FlushTexData(); curvb.FlushTexData();
if ((vb[!prim->ctxt].nCount > 0) && (vb[prim->ctxt].gsfb.fbp == vb[!prim->ctxt].gsfb.fbp)) if ((vb[!prim->ctxt].nCount > 0) && (vb[prim->ctxt].gsfb.fbp == vb[!prim->ctxt].gsfb.fbp))
{ {
@ -732,7 +723,7 @@ void ZeroGS::KickTriangle()
assert(gs.primC >= 3); assert(gs.primC >= 3);
VB& curvb = vb[prim->ctxt]; VB& curvb = vb[prim->ctxt];
if (curvb.bNeedTexCheck) curvb.FlushTexData(); curvb.FlushTexData();
if ((vb[!prim->ctxt].nCount > 0) && (vb[prim->ctxt].gsfb.fbp == vb[!prim->ctxt].gsfb.fbp)) if ((vb[!prim->ctxt].nCount > 0) && (vb[prim->ctxt].gsfb.fbp == vb[!prim->ctxt].gsfb.fbp))
{ {
@ -760,7 +751,7 @@ void ZeroGS::KickTriangleFan()
assert(gs.primC >= 3); assert(gs.primC >= 3);
VB& curvb = vb[prim->ctxt]; VB& curvb = vb[prim->ctxt];
if (curvb.bNeedTexCheck) curvb.FlushTexData(); curvb.FlushTexData();
if ((vb[!prim->ctxt].nCount > 0) && (vb[prim->ctxt].gsfb.fbp == vb[!prim->ctxt].gsfb.fbp)) if ((vb[!prim->ctxt].nCount > 0) && (vb[prim->ctxt].gsfb.fbp == vb[!prim->ctxt].gsfb.fbp))
{ {
@ -799,7 +790,7 @@ void ZeroGS::KickSprite()
assert(gs.primC >= 2); assert(gs.primC >= 2);
VB& curvb = vb[prim->ctxt]; VB& curvb = vb[prim->ctxt];
if (curvb.bNeedTexCheck) curvb.FlushTexData(); curvb.FlushTexData();
if ((vb[!prim->ctxt].nCount > 0) && (vb[prim->ctxt].gsfb.fbp == vb[!prim->ctxt].gsfb.fbp)) if ((vb[!prim->ctxt].nCount > 0) && (vb[prim->ctxt].gsfb.fbp == vb[!prim->ctxt].gsfb.fbp))
{ {

View File

@ -409,7 +409,11 @@ public:
frameInfo frame; frameInfo frame;
int zprimmask; // zmask for incoming points int zprimmask; // zmask for incoming points
union
{
u32 uCurTex0Data[2]; // current tex0 data u32 uCurTex0Data[2]; // current tex0 data
GIFRegTEX0 uCurTex0;
};
u32 uNextTex0Data[2]; // tex0 data that has to be applied if bNeedTexCheck is 1 u32 uNextTex0Data[2]; // tex0 data that has to be applied if bNeedTexCheck is 1
//int nFrameHeights[8]; // frame heights for the past frame changes //int nFrameHeights[8]; // frame heights for the past frame changes