mirror of https://github.com/PCSX2/pcsx2.git
GregMiscellaneous: zzogl-pg: Remove the ZeroGS namespace.
git-svn-id: http://pcsx2.googlecode.com/svn/branches/GregMiscellaneous@3924 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
87054c5452
commit
465f786dee
|
@ -47,14 +47,14 @@ LRESULT WINAPI MsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
nWindowWidth = lParam & 0xffff;
|
nWindowWidth = lParam & 0xffff;
|
||||||
nWindowHeight = lParam >> 16;
|
nWindowHeight = lParam >> 16;
|
||||||
ZeroGS::ChangeWindowSize(nWindowWidth, nWindowHeight);
|
ChangeWindowSize(nWindowWidth, nWindowHeight);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_SIZING:
|
case WM_SIZING:
|
||||||
// if button is 0, then just released so can resize
|
// if button is 0, then just released so can resize
|
||||||
if (GetSystemMetrics(SM_SWAPBUTTON) ? !GetAsyncKeyState(VK_RBUTTON) : !GetAsyncKeyState(VK_LBUTTON))
|
if (GetSystemMetrics(SM_SWAPBUTTON) ? !GetAsyncKeyState(VK_RBUTTON) : !GetAsyncKeyState(VK_LBUTTON))
|
||||||
{
|
{
|
||||||
ZeroGS::SetChangeDeviceSize(nWindowWidth, nWindowHeight);
|
SetChangeDeviceSize(nWindowWidth, nWindowHeight);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ void GLWindow::GetWindowSize()
|
||||||
XUnlockDisplay(glDisplay);
|
XUnlockDisplay(glDisplay);
|
||||||
|
|
||||||
// update the gl buffer size
|
// update the gl buffer size
|
||||||
ZeroGS::ChangeWindowSize(width, height);
|
ChangeWindowSize(width, height);
|
||||||
|
|
||||||
ZZLog::Error_Log("Resolution %dx%d. Depth %d bpp. Position (%d,%d)", width, height, depth, conf.x, conf.y);
|
ZZLog::Error_Log("Resolution %dx%d. Depth %d bpp. Position (%d,%d)", width, height, depth, conf.x, conf.y);
|
||||||
}
|
}
|
||||||
|
@ -336,7 +336,7 @@ void GLWindow::ResizeCheck()
|
||||||
width = event.xconfigure.width;
|
width = event.xconfigure.width;
|
||||||
height = event.xconfigure.height;
|
height = event.xconfigure.height;
|
||||||
Force43Ratio();
|
Force43Ratio();
|
||||||
ZeroGS::ChangeWindowSize(width, height);
|
ChangeWindowSize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fullScreen) {
|
if (!fullScreen) {
|
||||||
|
|
|
@ -296,12 +296,12 @@ void CALLBACK GSsetFrameSkip(int frameskip)
|
||||||
|
|
||||||
void CALLBACK GSreset()
|
void CALLBACK GSreset()
|
||||||
{
|
{
|
||||||
ZeroGS::GSReset();
|
ZZGSReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CALLBACK GSgifSoftReset(u32 mask)
|
void CALLBACK GSgifSoftReset(u32 mask)
|
||||||
{
|
{
|
||||||
ZeroGS::GSSoftReset(mask);
|
ZZGSSoftReset(mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 CALLBACK GSinit()
|
s32 CALLBACK GSinit()
|
||||||
|
@ -359,7 +359,7 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread)
|
||||||
ZZLog::GS_Log("Using %s:%d.%d.%d.", libraryName, zgsrevision, zgsbuild, zgsminor);
|
ZZLog::GS_Log("Using %s:%d.%d.%d.", libraryName, zgsrevision, zgsbuild, zgsminor);
|
||||||
ZZLog::WriteLn("Creating ZZOgl window.");
|
ZZLog::WriteLn("Creating ZZOgl window.");
|
||||||
|
|
||||||
if (!ZeroGS::Create(conf.width, conf.height)) return -1;
|
if (!ZZCreate(conf.width, conf.height)) return -1;
|
||||||
|
|
||||||
ZZLog::WriteLn("Initialization successful.");
|
ZZLog::WriteLn("Initialization successful.");
|
||||||
|
|
||||||
|
@ -382,7 +382,7 @@ void CALLBACK GSclose()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
ZeroGS::Destroy(1);
|
ZZDestroy(1);
|
||||||
GLWin.CloseWindow();
|
GLWin.CloseWindow();
|
||||||
|
|
||||||
SaveStateFile = NULL;
|
SaveStateFile = NULL;
|
||||||
|
@ -414,7 +414,7 @@ void CALLBACK GSchangeSaveState(int newstate, const char* filename)
|
||||||
|
|
||||||
char str[255];
|
char str[255];
|
||||||
sprintf(str, "save state %d", newstate);
|
sprintf(str, "save state %d", newstate);
|
||||||
ZeroGS::AddMessage(str);
|
ZZAddMessage(str);
|
||||||
CurrentSavestate = newstate;
|
CurrentSavestate = newstate;
|
||||||
|
|
||||||
SaveStateFile = filename;
|
SaveStateFile = filename;
|
||||||
|
@ -463,7 +463,7 @@ void CALLBACK GSmakeSnapshot(char *path)
|
||||||
fclose(bmpfile);
|
fclose(bmpfile);
|
||||||
|
|
||||||
// get the bits
|
// get the bits
|
||||||
ZeroGS::SaveSnapshot(filename);
|
SaveSnapshot(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
// I'll probably move this somewhere else later, but it's got a ton of dependencies.
|
// I'll probably move this somewhere else later, but it's got a ton of dependencies.
|
||||||
|
@ -491,7 +491,7 @@ static __forceinline void SetGSTitle()
|
||||||
100*g_nFramesSkipped / g_nFrame,
|
100*g_nFramesSkipped / g_nFrame,
|
||||||
g_nGenVars / (float)UPDATE_FRAMES, g_nTexVars / (float)UPDATE_FRAMES, g_nAlphaVars / (float)UPDATE_FRAMES,
|
g_nGenVars / (float)UPDATE_FRAMES, g_nTexVars / (float)UPDATE_FRAMES, g_nAlphaVars / (float)UPDATE_FRAMES,
|
||||||
g_nResolve / (float)UPDATE_FRAMES, (ppf&0xfffff) / (float)UPDATE_FRAMES,
|
g_nResolve / (float)UPDATE_FRAMES, (ppf&0xfffff) / (float)UPDATE_FRAMES,
|
||||||
ZeroGS::g_MemTargs.listTargets.size(), ZeroGS::g_MemTargs.listClearedTargets.size(), g_TransferredToGPU >> 10);
|
g_MemTargs.listTargets.size(), g_MemTargs.listClearedTargets.size(), g_TransferredToGPU >> 10);
|
||||||
|
|
||||||
//_snprintf(strtitle, 512, "%x %x", *(int*)(g_pbyGSMemory + 256 * 0x3e0c + 4), *(int*)(g_pbyGSMemory + 256 * 0x3e04 + 4));
|
//_snprintf(strtitle, 512, "%x %x", *(int*)(g_pbyGSMemory + 256 * 0x3e0c + 4), *(int*)(g_pbyGSMemory + 256 * 0x3e04 + 4));
|
||||||
#endif
|
#endif
|
||||||
|
@ -517,7 +517,7 @@ void CALLBACK GSvsync(int interlace)
|
||||||
g_nRealFrame++;
|
g_nRealFrame++;
|
||||||
|
|
||||||
// !interlace? Hmmm... Fixme.
|
// !interlace? Hmmm... Fixme.
|
||||||
ZeroGS::RenderCRTC(!interlace);
|
RenderCRTC(!interlace);
|
||||||
|
|
||||||
ProcessEvents();
|
ProcessEvents();
|
||||||
|
|
||||||
|
@ -571,7 +571,7 @@ void CALLBACK GSreadFIFO(u64 *pMem)
|
||||||
|
|
||||||
//ZZLog::GS_Log("Calling GSreadFIFO.");
|
//ZZLog::GS_Log("Calling GSreadFIFO.");
|
||||||
|
|
||||||
ZeroGS::TransferLocalHost((u32*)pMem, 1);
|
TransferLocalHost((u32*)pMem, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CALLBACK GSreadFIFO2(u64 *pMem, int qwc)
|
void CALLBACK GSreadFIFO2(u64 *pMem, int qwc)
|
||||||
|
@ -580,7 +580,7 @@ void CALLBACK GSreadFIFO2(u64 *pMem, int qwc)
|
||||||
|
|
||||||
//ZZLog::GS_Log("Calling GSreadFIFO2.");
|
//ZZLog::GS_Log("Calling GSreadFIFO2.");
|
||||||
|
|
||||||
ZeroGS::TransferLocalHost((u32*)pMem, qwc);
|
TransferLocalHost((u32*)pMem, qwc);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CALLBACK GSsetupRecording(int start, void* pData)
|
int CALLBACK GSsetupRecording(int start, void* pData)
|
||||||
|
@ -588,9 +588,9 @@ int CALLBACK GSsetupRecording(int start, void* pData)
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
if (start)
|
if (start)
|
||||||
ZeroGS::StartCapture();
|
StartCapture();
|
||||||
else
|
else
|
||||||
ZeroGS::StopCapture();
|
StopCapture();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -602,16 +602,16 @@ s32 CALLBACK GSfreeze(int mode, freezeData *data)
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case FREEZE_LOAD:
|
case FREEZE_LOAD:
|
||||||
if (!ZeroGS::Load(data->data)) ZZLog::Error_Log("GS: Bad load format!");
|
if (!ZZLoad(data->data)) ZZLog::Error_Log("GS: Bad load format!");
|
||||||
g_nRealFrame += 100;
|
g_nRealFrame += 100;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FREEZE_SAVE:
|
case FREEZE_SAVE:
|
||||||
ZeroGS::Save(data->data);
|
ZZSave(data->data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FREEZE_SIZE:
|
case FREEZE_SIZE:
|
||||||
data->size = ZeroGS::Save(NULL);
|
data->size = ZZSave(NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -168,7 +168,7 @@ template<int index> void _GSgifTransfer(const u32 *pMem, u32 size)
|
||||||
switch (gs.imageTransfer)
|
switch (gs.imageTransfer)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
ZeroGS::TransferHostLocal(pMem, len * 4);
|
TransferHostLocal(pMem, len * 4);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -176,11 +176,11 @@ template<int index> void _GSgifTransfer(const u32 *pMem, u32 size)
|
||||||
// a GIFtag operation. They're an entirely separate process that can only be
|
// a GIFtag operation. They're an entirely separate process that can only be
|
||||||
// done through the ReverseFIFO transfer (aka ReadFIFO). --air
|
// done through the ReverseFIFO transfer (aka ReadFIFO). --air
|
||||||
assert(0);
|
assert(0);
|
||||||
//ZeroGS::TransferLocalHost(pMem, len);
|
//TransferLocalHost(pMem, len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
//ZeroGS::TransferLocalLocal();
|
//TransferLocalLocal();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
|
|
|
@ -71,8 +71,6 @@
|
||||||
|
|
||||||
extern _getPixelAddress getPixelFun[64];
|
extern _getPixelAddress getPixelFun[64];
|
||||||
|
|
||||||
namespace ZeroGS
|
|
||||||
{
|
|
||||||
extern CRangeManager s_RangeMngr; // manages overwritten memory
|
extern CRangeManager s_RangeMngr; // manages overwritten memory
|
||||||
extern void ResolveInRange(int start, int end);
|
extern void ResolveInRange(int start, int end);
|
||||||
|
|
||||||
|
@ -535,5 +533,3 @@ __forceinline void _TransferLocalLocal_4()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -158,8 +158,8 @@ static __forceinline int FinishTransfer(TransferData data, int nLeftOver)
|
||||||
assert(gs.imageTransfer == -1 || tempY == gs.imageEndY);
|
assert(gs.imageTransfer == -1 || tempY == gs.imageEndY);
|
||||||
gs.imageTransfer = -1;
|
gs.imageTransfer = -1;
|
||||||
/*int start, end;
|
/*int start, end;
|
||||||
ZeroGS::GetRectMemAddress(start, end, gs.dstbuf.psm, gs.trxpos.dx, gs.trxpos.dy, gs.imageWnew, gs.imageHnew, gs.dstbuf.bp, gs.dstbuf.bw);
|
GetRectMemAddress(start, end, gs.dstbuf.psm, gs.trxpos.dx, gs.trxpos.dy, gs.imageWnew, gs.imageHnew, gs.dstbuf.bp, gs.dstbuf.bw);
|
||||||
ZeroGS::g_MemTargs.ClearRange(start, end);*/
|
g_MemTargs.ClearRange(start, end);*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,14 +58,14 @@ inline bool NoHighlights(int i)
|
||||||
|
|
||||||
u32 resultA = prim->iip + (2 * (prim->tme)) + (4 * (prim->fge)) + (8 * (prim->abe)) + (16 * (prim->aa1)) + (32 * (prim->fst)) + (64 * (prim->ctxt)) + (128 * (prim->fix));
|
u32 resultA = prim->iip + (2 * (prim->tme)) + (4 * (prim->fge)) + (8 * (prim->abe)) + (16 * (prim->aa1)) + (32 * (prim->fst)) + (64 * (prim->ctxt)) + (128 * (prim->fix));
|
||||||
|
|
||||||
const pixTest curtest = ZeroGS::vb[i].test;
|
const pixTest curtest = vb[i].test;
|
||||||
|
|
||||||
u32 result = curtest.ate + ((curtest.atst) << 1) +((curtest.afail) << 4) + ((curtest.date) << 6) + ((curtest.datm) << 7) + ((curtest.zte) << 8) + ((curtest.ztst)<< 9);
|
u32 result = curtest.ate + ((curtest.atst) << 1) +((curtest.afail) << 4) + ((curtest.date) << 6) + ((curtest.datm) << 7) + ((curtest.zte) << 8) + ((curtest.ztst)<< 9);
|
||||||
|
|
||||||
if ((resultA == 0x310a) && (result == 0x0)) return false; // Radiata Stories
|
if ((resultA == 0x310a) && (result == 0x0)) return false; // Radiata Stories
|
||||||
|
|
||||||
//Old code
|
//Old code
|
||||||
return (!(conf.settings().xenosaga_spec) || !ZeroGS::vb[i].zbuf.zmsk || prim->iip) ;
|
return (!(conf.settings().xenosaga_spec) || !vb[i].zbuf.zmsk || prim->iip) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFPackedRegHandlerNull(const u32* data)
|
void __gifCall GIFPackedRegHandlerNull(const u32* data)
|
||||||
|
@ -132,7 +132,7 @@ void __gifCall KickVertex(bool adc)
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
if (++gs.primC >= (int)g_primmult[prim->prim])
|
if (++gs.primC >= (int)g_primmult[prim->prim])
|
||||||
{
|
{
|
||||||
if (!adc && NoHighlights(prim->ctxt)) (*ZeroGS::drawfn[prim->prim])();
|
if (!adc && NoHighlights(prim->ctxt)) (*drawfn[prim->prim])();
|
||||||
|
|
||||||
gs.primC -= g_primsub[prim->prim];
|
gs.primC -= g_primsub[prim->prim];
|
||||||
|
|
||||||
|
@ -275,22 +275,22 @@ void __gifCall GIFRegHandlerTEX0(const u32* data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Order is important.
|
// Order is important.
|
||||||
ZeroGS::vb[i].uNextTex0Data[0] = r->ai32[0];
|
vb[i].uNextTex0Data[0] = r->ai32[0];
|
||||||
ZeroGS::vb[i].uNextTex0Data[1] = r->ai32[1];
|
vb[i].uNextTex0Data[1] = r->ai32[1];
|
||||||
ZeroGS::vb[i].bNeedTexCheck = 1;
|
vb[i].bNeedTexCheck = 1;
|
||||||
|
|
||||||
// don't update unless necessary
|
// don't update unless necessary
|
||||||
if (PSMT_ISCLUT(psm))
|
if (PSMT_ISCLUT(psm))
|
||||||
{
|
{
|
||||||
if (ZeroGS::CheckChangeInClut(data[1], psm))
|
if (CheckChangeInClut(data[1], psm))
|
||||||
{
|
{
|
||||||
// loading clut, so flush whole texture
|
// loading clut, so flush whole texture
|
||||||
ZeroGS::vb[i].FlushTexData();
|
vb[i].FlushTexData();
|
||||||
}
|
}
|
||||||
else if (r->CSA != (ZeroGS::vb[i].uCurTex0.CSA))
|
else if (r->CSA != (vb[i].uCurTex0.CSA))
|
||||||
{
|
{
|
||||||
// check if csa is the same!! (ffx bisaid island, grass)
|
// check if csa is the same!! (ffx bisaid island, grass)
|
||||||
ZeroGS::Flush(i); // flush any previous entries
|
Flush(i); // flush any previous entries
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ template <u32 i>
|
||||||
void __gifCall GIFRegHandlerCLAMP(const u32* data)
|
void __gifCall GIFRegHandlerCLAMP(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
clampInfo& clamp = ZeroGS::vb[i].clamp;
|
clampInfo& clamp = vb[i].clamp;
|
||||||
GIFRegCLAMP* r = (GIFRegCLAMP*)(data);
|
GIFRegCLAMP* r = (GIFRegCLAMP*)(data);
|
||||||
|
|
||||||
// Worry about this later.
|
// Worry about this later.
|
||||||
|
@ -307,9 +307,9 @@ void __gifCall GIFRegHandlerCLAMP(const 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);
|
Flush(i);
|
||||||
|
|
||||||
ZeroGS::vb[i].bTexConstsSync = false;
|
vb[i].bTexConstsSync = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
s_uClampData[i] = data[0];
|
s_uClampData[i] = data[0];
|
||||||
|
@ -361,15 +361,15 @@ void __fastcall GIFRegHandlerTEX1(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
GIFRegTEX1* r = (GIFRegTEX1*)(data);
|
GIFRegTEX1* r = (GIFRegTEX1*)(data);
|
||||||
tex1Info& tex1 = ZeroGS::vb[i].tex1;
|
tex1Info& tex1 = vb[i].tex1;
|
||||||
|
|
||||||
// Worry about this later.
|
// Worry about this later.
|
||||||
if (!NoHighlights(i)) return;
|
if (!NoHighlights(i)) return;
|
||||||
|
|
||||||
if (conf.bilinear == 1 && (tex1.mmag != r->MMAG || tex1.mmin != r->MMIN))
|
if (conf.bilinear == 1 && (tex1.mmag != r->MMAG || tex1.mmin != r->MMIN))
|
||||||
{
|
{
|
||||||
ZeroGS::Flush(i);
|
Flush(i);
|
||||||
ZeroGS::vb[i].bVarsTexSync = false;
|
vb[i].bVarsTexSync = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
tex1.lcm = r->LCM;
|
tex1.lcm = r->LCM;
|
||||||
|
@ -387,13 +387,13 @@ template <u32 i>
|
||||||
void __gifCall GIFRegHandlerTEX2(const u32* data)
|
void __gifCall GIFRegHandlerTEX2(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
tex0Info& tex0 = ZeroGS::vb[i].tex0;
|
tex0Info& tex0 = vb[i].tex0;
|
||||||
|
|
||||||
ZeroGS::vb[i].FlushTexData();
|
vb[i].FlushTexData();
|
||||||
|
|
||||||
u32 psm = ZZOglGet_psm_TexBitsFix(data[0]);
|
u32 psm = ZZOglGet_psm_TexBitsFix(data[0]);
|
||||||
|
|
||||||
u32* s_uTex0Data = ZeroGS::vb[i].uCurTex0Data;
|
u32* s_uTex0Data = vb[i].uCurTex0Data;
|
||||||
|
|
||||||
// don't update unless necessary
|
// don't update unless necessary
|
||||||
// if( ZZOglGet_psm_TexBitsFix(*s_uTex0Data) == ZZOglGet_psm_TexBitsFix(data[0]) ) { // psm is the same
|
// if( ZZOglGet_psm_TexBitsFix(*s_uTex0Data) == ZZOglGet_psm_TexBitsFix(data[0]) ) { // psm is the same
|
||||||
|
@ -408,26 +408,26 @@ void __gifCall GIFRegHandlerTEX2(const u32* data)
|
||||||
|
|
||||||
if (tex0.cld != 0)
|
if (tex0.cld != 0)
|
||||||
{
|
{
|
||||||
ZeroGS::texClutWrite(i);
|
texClutWrite(i);
|
||||||
// invalidate to make sure target didn't change!
|
// invalidate to make sure target didn't change!
|
||||||
ZeroGS::vb[i].bVarsTexSync = false;
|
vb[i].bVarsTexSync = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroGS::Flush(i);
|
Flush(i);
|
||||||
|
|
||||||
ZeroGS::vb[i].bVarsTexSync = false;
|
vb[i].bVarsTexSync = false;
|
||||||
ZeroGS::vb[i].bTexConstsSync = false;
|
vb[i].bTexConstsSync = false;
|
||||||
|
|
||||||
s_uTex0Data[0] = (s_uTex0Data[0] & ~0x03f00000) | (psm << 20);
|
s_uTex0Data[0] = (s_uTex0Data[0] & ~0x03f00000) | (psm << 20);
|
||||||
s_uTex0Data[1] = (s_uTex0Data[1] & 0x1f) | (data[1] & ~0x1f);
|
s_uTex0Data[1] = (s_uTex0Data[1] & 0x1f) | (data[1] & ~0x1f);
|
||||||
|
|
||||||
tex0.psm = ZZOglGet_psm_TexBitsFix(data[0]);
|
tex0.psm = ZZOglGet_psm_TexBitsFix(data[0]);
|
||||||
|
|
||||||
if (PSMT_ISCLUT(tex0.psm)) ZeroGS::CluttingForFlushedTex(&tex0, data[1], i);
|
if (PSMT_ISCLUT(tex0.psm)) CluttingForFlushedTex(&tex0, data[1], i);
|
||||||
ZZLog::Greg_Log("TEX2_%d: 0x%x", i, data);
|
ZZLog::Greg_Log("TEX2_%d: 0x%x", i, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,8 +437,8 @@ void __gifCall GIFRegHandlerXYOFFSET(const u32* data)
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
// Affects that Mana Khemia opening dialog (when i == 0).
|
// Affects that Mana Khemia opening dialog (when i == 0).
|
||||||
GIFRegXYOFFSET* r = (GIFRegXYOFFSET*)(data);
|
GIFRegXYOFFSET* r = (GIFRegXYOFFSET*)(data);
|
||||||
ZeroGS::vb[i].offset.x = r->OFX;
|
vb[i].offset.x = r->OFX;
|
||||||
ZeroGS::vb[i].offset.y = r->OFY;
|
vb[i].offset.y = r->OFY;
|
||||||
ZZLog::Greg_Log("XYOFFSET_%d: 0x%x, 0x%x", i, r->OFX, r->OFY);
|
ZZLog::Greg_Log("XYOFFSET_%d: 0x%x, 0x%x", i, r->OFX, r->OFY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -462,7 +462,7 @@ void __gifCall GIFRegHandlerPRIM(const u32 *data)
|
||||||
gs._prim[1].prim = r->PRIM;
|
gs._prim[1].prim = r->PRIM;
|
||||||
gs._prim[1]._val = (data[0] >> 3) & 0xff; // Setting the next 8 flags after prim at once.
|
gs._prim[1]._val = (data[0] >> 3) & 0xff; // Setting the next 8 flags after prim at once.
|
||||||
|
|
||||||
ZeroGS::Prim();
|
Prim();
|
||||||
ZZLog::Greg_Log("PRIM");
|
ZZLog::Greg_Log("PRIM");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,7 +474,7 @@ void __gifCall GIFRegHandlerPRMODE(const u32* data)
|
||||||
// Re-examine all code dealing with PRIMs in a bit.
|
// Re-examine all code dealing with PRIMs in a bit.
|
||||||
gs._prim[0]._val = (data[0] >> 3) & 0xff;
|
gs._prim[0]._val = (data[0] >> 3) & 0xff;
|
||||||
|
|
||||||
if (gs.prac == 0) ZeroGS::Prim();
|
if (gs.prac == 0) Prim();
|
||||||
ZZLog::Greg_Log("PRMODE");
|
ZZLog::Greg_Log("PRMODE");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,7 +487,7 @@ void __gifCall GIFRegHandlerPRMODECONT(const u32* data)
|
||||||
gs.prac = r->AC;
|
gs.prac = r->AC;
|
||||||
prim = &gs._prim[gs.prac];
|
prim = &gs._prim[gs.prac];
|
||||||
|
|
||||||
ZeroGS::Prim();
|
Prim();
|
||||||
ZZLog::Greg_Log("PRMODECONT");
|
ZZLog::Greg_Log("PRMODECONT");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,8 +497,8 @@ void __gifCall GIFRegHandlerTEXCLUT(const u32* data)
|
||||||
// Affects background coloration of initial Mana Khemia dialog.
|
// Affects background coloration of initial Mana Khemia dialog.
|
||||||
GIFRegTEXCLUT* r = (GIFRegTEXCLUT*)(data);
|
GIFRegTEXCLUT* r = (GIFRegTEXCLUT*)(data);
|
||||||
|
|
||||||
ZeroGS::vb[0].FlushTexData();
|
vb[0].FlushTexData();
|
||||||
ZeroGS::vb[1].FlushTexData();
|
vb[1].FlushTexData();
|
||||||
|
|
||||||
// Fixme.
|
// Fixme.
|
||||||
gs.clut.cbw = r->CBW << 6;
|
gs.clut.cbw = r->CBW << 6;
|
||||||
|
@ -514,9 +514,9 @@ void __gifCall GIFRegHandlerSCANMSK(const u32* data)
|
||||||
|
|
||||||
if(r->MSK != gs.smask)
|
if(r->MSK != gs.smask)
|
||||||
{
|
{
|
||||||
ZeroGS::FlushBoth();
|
FlushBoth();
|
||||||
// ZeroGS::ResolveC(&ZeroGS::vb[0]);
|
// ResolveC(&vb[0]);
|
||||||
// ZeroGS::ResolveZ(&ZeroGS::vb[0]);
|
// ResolveZ(&vb[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
gs.smask = r->MSK;
|
gs.smask = r->MSK;
|
||||||
|
@ -533,7 +533,7 @@ void __gifCall GIFRegHandlerMIPTBP1(const u32* data)
|
||||||
Flush();
|
Flush();
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
miptbpInfo& miptbp0 = ZeroGS::vb[i].miptbp0;
|
miptbpInfo& miptbp0 = vb[i].miptbp0;
|
||||||
miptbp0.tbp[0] = r->TBP1;
|
miptbp0.tbp[0] = r->TBP1;
|
||||||
miptbp0.tbw[0] = r->TBW1;
|
miptbp0.tbw[0] = r->TBW1;
|
||||||
miptbp0.tbp[1] = r->TBP2;
|
miptbp0.tbp[1] = r->TBP2;
|
||||||
|
@ -550,7 +550,7 @@ void __gifCall GIFRegHandlerMIPTBP2(const u32* data)
|
||||||
GIFRegMIPTBP2* r = (GIFRegMIPTBP2*)(data);
|
GIFRegMIPTBP2* r = (GIFRegMIPTBP2*)(data);
|
||||||
// Yep.
|
// Yep.
|
||||||
|
|
||||||
miptbpInfo& miptbp1 = ZeroGS::vb[i].miptbp1;
|
miptbpInfo& miptbp1 = vb[i].miptbp1;
|
||||||
miptbp1.tbp[0] = r->TBP4;
|
miptbp1.tbp[0] = r->TBP4;
|
||||||
miptbp1.tbw[0] = r->TBW4;
|
miptbp1.tbw[0] = r->TBW4;
|
||||||
miptbp1.tbp[1] = r->TBP5;
|
miptbp1.tbp[1] = r->TBP5;
|
||||||
|
@ -568,10 +568,10 @@ void __gifCall GIFRegHandlerTEXA(const u32* data)
|
||||||
|
|
||||||
if ((r->AEM != gs.texa.aem) || (r->TA0 != gs.texa.ta[0]) || (r->TA1 != gs.texa.ta[1]))
|
if ((r->AEM != gs.texa.aem) || (r->TA0 != gs.texa.ta[0]) || (r->TA1 != gs.texa.ta[1]))
|
||||||
{
|
{
|
||||||
ZeroGS::FlushBoth();
|
FlushBoth();
|
||||||
|
|
||||||
ZeroGS::vb[0].bTexConstsSync = false;
|
vb[0].bTexConstsSync = false;
|
||||||
ZeroGS::vb[1].bTexConstsSync = false;
|
vb[1].bTexConstsSync = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
gs.texa.aem = r->AEM;
|
gs.texa.aem = r->AEM;
|
||||||
|
@ -589,10 +589,10 @@ void __gifCall GIFRegHandlerFOGCOL(const u32* data)
|
||||||
|
|
||||||
if (gs.fogcol != r->ai32[0])
|
if (gs.fogcol != r->ai32[0])
|
||||||
{
|
{
|
||||||
ZeroGS::FlushBoth();
|
FlushBoth();
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroGS::SetFogColor(r);
|
SetFogColor(r);
|
||||||
gs.fogcol = r->ai32[0];
|
gs.fogcol = r->ai32[0];
|
||||||
ZZLog::Greg_Log("FOGCOL: 0x%x", r->ai32[0]);
|
ZZLog::Greg_Log("FOGCOL: 0x%x", r->ai32[0]);
|
||||||
}
|
}
|
||||||
|
@ -601,7 +601,7 @@ void __gifCall GIFRegHandlerTEXFLUSH(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
// GSdx doesn't even do anything here.
|
// GSdx doesn't even do anything here.
|
||||||
ZeroGS::SetTexFlush();
|
SetTexFlush();
|
||||||
ZZLog::Greg_Log("TEXFLUSH");
|
ZZLog::Greg_Log("TEXFLUSH");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -610,7 +610,7 @@ void __gifCall GIFRegHandlerSCISSOR(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
GIFRegSCISSOR* r = (GIFRegSCISSOR*)(data);
|
GIFRegSCISSOR* r = (GIFRegSCISSOR*)(data);
|
||||||
Rect2& scissor = ZeroGS::vb[i].scissor;
|
Rect2& scissor = vb[i].scissor;
|
||||||
|
|
||||||
Rect2 newscissor;
|
Rect2 newscissor;
|
||||||
|
|
||||||
|
@ -623,10 +623,10 @@ void __gifCall GIFRegHandlerSCISSOR(const u32* data)
|
||||||
if (newscissor.x1 != scissor.x1 || newscissor.y1 != scissor.y1 ||
|
if (newscissor.x1 != scissor.x1 || newscissor.y1 != scissor.y1 ||
|
||||||
newscissor.x0 != scissor.x0 || newscissor.y0 != scissor.y0)
|
newscissor.x0 != scissor.x0 || newscissor.y0 != scissor.y0)
|
||||||
{
|
{
|
||||||
ZeroGS::Flush(i);
|
Flush(i);
|
||||||
|
|
||||||
// flush everything
|
// flush everything
|
||||||
ZeroGS::vb[i].bNeedFrameCheck = 1;
|
vb[i].bNeedFrameCheck = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
scissor = newscissor;
|
scissor = newscissor;
|
||||||
|
@ -663,12 +663,12 @@ void __gifCall GIFRegHandlerALPHA(const u32* data)
|
||||||
if (newalpha.c == 3) newalpha.c = 0;
|
if (newalpha.c == 3) newalpha.c = 0;
|
||||||
if (newalpha.d == 3) newalpha.d = 0;
|
if (newalpha.d == 3) newalpha.d = 0;
|
||||||
|
|
||||||
if ((newalpha.abcd != ZeroGS::vb[i].alpha.abcd) || (newalpha.fix != ZeroGS::vb[i].alpha.fix))
|
if ((newalpha.abcd != vb[i].alpha.abcd) || (newalpha.fix != vb[i].alpha.fix))
|
||||||
{
|
{
|
||||||
ZeroGS::Flush(i);
|
Flush(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroGS::vb[i].alpha = newalpha;
|
vb[i].alpha = newalpha;
|
||||||
ZZLog::Greg_Log("ALPHA%d: A:0x%x B:0x%x C:0x%x D:0x%x FIX:0x%x ", i, r->A, r->B, r->C, r->D, r->FIX);
|
ZZLog::Greg_Log("ALPHA%d: A:0x%x B:0x%x C:0x%x D:0x%x FIX:0x%x ", i, r->A, r->B, r->C, r->D, r->FIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -682,7 +682,7 @@ void __gifCall GIFRegHandlerDIMX(const u32* data)
|
||||||
|
|
||||||
if (r->i64 != gs.dimx.i64)
|
if (r->i64 != gs.dimx.i64)
|
||||||
{
|
{
|
||||||
ZeroGS::FlushBoth();
|
FlushBoth();
|
||||||
|
|
||||||
update = true;
|
update = true;
|
||||||
}
|
}
|
||||||
|
@ -703,7 +703,7 @@ void __gifCall GIFRegHandlerDTHE(const u32* data)
|
||||||
|
|
||||||
if (r->DTHE != gs.dthe)
|
if (r->DTHE != gs.dthe)
|
||||||
{
|
{
|
||||||
ZeroGS::FlushBoth();
|
FlushBoth();
|
||||||
}
|
}
|
||||||
|
|
||||||
gs.dthe = r->DTHE;
|
gs.dthe = r->DTHE;
|
||||||
|
@ -717,7 +717,7 @@ void __gifCall GIFRegHandlerCOLCLAMP(const u32* data)
|
||||||
|
|
||||||
if (r->CLAMP != gs.colclamp)
|
if (r->CLAMP != gs.colclamp)
|
||||||
{
|
{
|
||||||
ZeroGS::FlushBoth();
|
FlushBoth();
|
||||||
}
|
}
|
||||||
|
|
||||||
gs.colclamp = r->CLAMP;
|
gs.colclamp = r->CLAMP;
|
||||||
|
@ -728,12 +728,12 @@ template <u32 i>
|
||||||
void __gifCall GIFRegHandlerTEST(const u32* data)
|
void __gifCall GIFRegHandlerTEST(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
pixTest* test = &ZeroGS::vb[i].test;
|
pixTest* test = &vb[i].test;
|
||||||
GIFRegTEST* r = (GIFRegTEST*)(data);
|
GIFRegTEST* r = (GIFRegTEST*)(data);
|
||||||
|
|
||||||
if (test->_val != r->ai32[0])
|
if (test->_val != r->ai32[0])
|
||||||
{
|
{
|
||||||
ZeroGS::Flush(i);
|
Flush(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
test->_val = r->ai32[0];
|
test->_val = r->ai32[0];
|
||||||
|
@ -747,9 +747,9 @@ void __gifCall GIFRegHandlerPABE(const u32* data)
|
||||||
|
|
||||||
if (gs.pabe != r->PABE)
|
if (gs.pabe != r->PABE)
|
||||||
{
|
{
|
||||||
ZeroGS::FlushBoth();
|
FlushBoth();
|
||||||
// ZeroGS::SetAlphaChanged(0, GPUREG_PABE);
|
// SetAlphaChanged(0, GPUREG_PABE);
|
||||||
// ZeroGS::SetAlphaChanged(1, GPUREG_PABE);
|
// SetAlphaChanged(1, GPUREG_PABE);
|
||||||
}
|
}
|
||||||
|
|
||||||
gs.pabe = r->PABE;
|
gs.pabe = r->PABE;
|
||||||
|
@ -762,12 +762,12 @@ void __gifCall GIFRegHandlerFBA(const u32* data)
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
GIFRegFBA* r = (GIFRegFBA*)(data);
|
GIFRegFBA* r = (GIFRegFBA*)(data);
|
||||||
|
|
||||||
if (r->FBA != ZeroGS::vb[i].fba.fba)
|
if (r->FBA != vb[i].fba.fba)
|
||||||
{
|
{
|
||||||
ZeroGS::FlushBoth();
|
FlushBoth();
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroGS::vb[i].fba.fba = r->FBA;
|
vb[i].fba.fba = r->FBA;
|
||||||
ZZLog::Greg_Log("FBA%d: 0x%x ", i, r->FBA);
|
ZZLog::Greg_Log("FBA%d: 0x%x ", i, r->FBA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -778,7 +778,7 @@ void __gifCall GIFRegHandlerFRAME(const u32* data)
|
||||||
// Affects opening dialogs, movie, and menu on Mana Khemia.
|
// Affects opening dialogs, movie, and menu on Mana Khemia.
|
||||||
|
|
||||||
GIFRegFRAME* r = (GIFRegFRAME*)(data);
|
GIFRegFRAME* r = (GIFRegFRAME*)(data);
|
||||||
frameInfo& gsfb = ZeroGS::vb[i].gsfb;
|
frameInfo& gsfb = vb[i].gsfb;
|
||||||
|
|
||||||
int fbw = r->FBW * 64;
|
int fbw = r->FBW * 64;
|
||||||
int fbp = r->FBP * 32;
|
int fbp = r->FBP * 32;
|
||||||
|
@ -798,7 +798,7 @@ void __gifCall GIFRegHandlerFRAME(const u32* data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroGS::FlushBoth();
|
FlushBoth();
|
||||||
if (r->FBW > 0) fbh = ZZOgl_fbh_Calc(r->FBP, r->FBW, r->PSM);
|
if (r->FBW > 0) fbh = ZZOgl_fbh_Calc(r->FBP, r->FBW, r->PSM);
|
||||||
|
|
||||||
gsfb.fbp = fbp;
|
gsfb.fbp = fbp;
|
||||||
|
@ -808,7 +808,7 @@ void __gifCall GIFRegHandlerFRAME(const u32* data)
|
||||||
gsfb.fbm = ZZOglGet_fbm_FrameBitsFix(data[0], data[1]);
|
gsfb.fbm = ZZOglGet_fbm_FrameBitsFix(data[0], data[1]);
|
||||||
|
|
||||||
|
|
||||||
ZeroGS::vb[i].bNeedFrameCheck = 1;
|
vb[i].bNeedFrameCheck = 1;
|
||||||
ZZLog::Greg_Log("FRAME_%d", i);
|
ZZLog::Greg_Log("FRAME_%d", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -820,7 +820,7 @@ void __gifCall GIFRegHandlerZBUF(const u32* data)
|
||||||
GIFRegZBUF* r = (GIFRegZBUF*)(data);
|
GIFRegZBUF* r = (GIFRegZBUF*)(data);
|
||||||
ZZLog::Greg_Log("ZBUF_1");
|
ZZLog::Greg_Log("ZBUF_1");
|
||||||
|
|
||||||
zbufInfo& zbuf = ZeroGS::vb[i].zbuf;
|
zbufInfo& zbuf = vb[i].zbuf;
|
||||||
int psm = (0x30 | r->PSM);
|
int psm = (0x30 | r->PSM);
|
||||||
int zbp = r->ZBP * 32;
|
int zbp = r->ZBP * 32;
|
||||||
|
|
||||||
|
@ -834,17 +834,17 @@ void __gifCall GIFRegHandlerZBUF(const u32* data)
|
||||||
// error detection
|
// error detection
|
||||||
if (m_Blocks[psm].bpp == 0) return;
|
if (m_Blocks[psm].bpp == 0) return;
|
||||||
|
|
||||||
ZeroGS::FlushBoth();
|
FlushBoth();
|
||||||
|
|
||||||
zbuf.zbp = zbp;
|
zbuf.zbp = zbp;
|
||||||
zbuf.psm = psm;
|
zbuf.psm = psm;
|
||||||
zbuf.zmsk = r->ZMSK;
|
zbuf.zmsk = r->ZMSK;
|
||||||
|
|
||||||
ZeroGS::vb[i].zprimmask = 0xffffffff;
|
vb[i].zprimmask = 0xffffffff;
|
||||||
|
|
||||||
if (zbuf.psm > 0x31) ZeroGS::vb[i].zprimmask = 0xffff;
|
if (zbuf.psm > 0x31) vb[i].zprimmask = 0xffff;
|
||||||
|
|
||||||
ZeroGS::vb[i].bNeedZCheck = 1;
|
vb[i].bNeedZCheck = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerBITBLTBUF(const u32* data)
|
void __gifCall GIFRegHandlerBITBLTBUF(const u32* data)
|
||||||
|
@ -915,7 +915,7 @@ void __gifCall GIFRegHandlerTRXDIR(const u32* data)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // loc->host
|
case 1: // loc->host
|
||||||
ZeroGS::TerminateLocalHost();
|
TerminateLocalHost();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -932,15 +932,15 @@ void __gifCall GIFRegHandlerTRXDIR(const u32* data)
|
||||||
switch (gs.imageTransfer)
|
switch (gs.imageTransfer)
|
||||||
{
|
{
|
||||||
case 0: // host->loc
|
case 0: // host->loc
|
||||||
ZeroGS::InitTransferHostLocal();
|
InitTransferHostLocal();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // loc->host
|
case 1: // loc->host
|
||||||
ZeroGS::InitTransferLocalHost();
|
InitTransferLocalHost();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
ZeroGS::TransferLocalLocal();
|
TransferLocalLocal();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -967,7 +967,7 @@ void __gifCall GIFRegHandlerHWREG(const u32* data)
|
||||||
|
|
||||||
if (gs.imageTransfer == 0)
|
if (gs.imageTransfer == 0)
|
||||||
{
|
{
|
||||||
ZeroGS::TransferHostLocal(data, 2);
|
TransferHostLocal(data, 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,9 +57,9 @@ inline bool NoHighlights(int i)
|
||||||
// results[resultA] = 1;
|
// results[resultA] = 1;
|
||||||
// ZZLog::Error_Log("%x = %d %d %d %d %d %d %d %d \n", resultA, prim->iip, (prim->tme), (prim->fge), (prim->abe) , (prim->aa1) ,(prim->fst), (prim->ctxt), (prim->fix)) ;
|
// ZZLog::Error_Log("%x = %d %d %d %d %d %d %d %d \n", resultA, prim->iip, (prim->tme), (prim->fge), (prim->abe) , (prim->aa1) ,(prim->fst), (prim->ctxt), (prim->fix)) ;
|
||||||
// }
|
// }
|
||||||
// if (resultA == 0xb && ZeroGS::vb[i].zbuf.zmsk ) return false; //ATF
|
// if (resultA == 0xb && vb[i].zbuf.zmsk ) return false; //ATF
|
||||||
|
|
||||||
const pixTest curtest = ZeroGS::vb[i].test;
|
const pixTest curtest = vb[i].test;
|
||||||
|
|
||||||
u32 result = curtest.ate + ((curtest.atst) << 1) +((curtest.afail) << 4) + ((curtest.date) << 6) + ((curtest.datm) << 7) + ((curtest.zte) << 8) + ((curtest.ztst)<< 9);
|
u32 result = curtest.ate + ((curtest.atst) << 1) +((curtest.afail) << 4) + ((curtest.date) << 6) + ((curtest.datm) << 7) + ((curtest.zte) << 8) + ((curtest.ztst)<< 9);
|
||||||
// if (resultA == 0xb)
|
// if (resultA == 0xb)
|
||||||
|
@ -68,18 +68,18 @@ inline bool NoHighlights(int i)
|
||||||
// ZZLog::Error_Log("0x%x = %d %d %d %d %d %d %d %d ", result, curtest.ate, curtest.atst, curtest.aref, curtest.afail, curtest.date, curtest.datm, curtest.zte, curtest.ztst);
|
// ZZLog::Error_Log("0x%x = %d %d %d %d %d %d %d %d ", result, curtest.ate, curtest.atst, curtest.aref, curtest.afail, curtest.date, curtest.datm, curtest.zte, curtest.ztst);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//if (result == 0x50b && ZeroGS::vb[i].zbuf.zmsk ) return false; //ATF
|
//if (result == 0x50b && vb[i].zbuf.zmsk ) return false; //ATF
|
||||||
//if ((resultA == 0x3a2a || resultA == 0x312a) && (result == 0x302 || result == 0x700) && (ZeroGS::vb[i].zbuf.zmsk)) return false; // Silent Hill:SM and Front Mission 5, result != 0x300
|
//if ((resultA == 0x3a2a || resultA == 0x312a) && (result == 0x302 || result == 0x700) && (vb[i].zbuf.zmsk)) return false; // Silent Hill:SM and Front Mission 5, result != 0x300
|
||||||
//if (((resultA == 0x3100) || (resultA == 0x3108)) && ((result == 0x54c) || (result == 0x50c)) && (ZeroGS::vb[i].zbuf.zmsk)) return false; // Okage
|
//if (((resultA == 0x3100) || (resultA == 0x3108)) && ((result == 0x54c) || (result == 0x50c)) && (vb[i].zbuf.zmsk)) return false; // Okage
|
||||||
|
|
||||||
if ((resultA == 0x310a) && (result == 0x0)) return false; // Radiata Stories
|
if ((resultA == 0x310a) && (result == 0x0)) return false; // Radiata Stories
|
||||||
|
|
||||||
//if (resultA == 0x3a6a && (result == 0x300 || result == 0x500) && ZeroGS::vb[i].zbuf.zmsk) return false; // Okami, result != 0x30d
|
//if (resultA == 0x3a6a && (result == 0x300 || result == 0x500) && vb[i].zbuf.zmsk) return false; // Okami, result != 0x30d
|
||||||
|
|
||||||
//if ((resultA == 0x300b) && (result == 0x300) && ZeroGS::vb[i].zbuf.zmsk) return false; // ATF, but no Melty Blood
|
//if ((resultA == 0x300b) && (result == 0x300) && vb[i].zbuf.zmsk) return false; // ATF, but no Melty Blood
|
||||||
|
|
||||||
// Old code
|
// Old code
|
||||||
return (!(conf.settings().xenosaga_spec) || !ZeroGS::vb[i].zbuf.zmsk || prim->iip) ;
|
return (!(conf.settings().xenosaga_spec) || !vb[i].zbuf.zmsk || prim->iip) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFPackedRegHandlerNull(const u32* data)
|
void __gifCall GIFPackedRegHandlerNull(const u32* data)
|
||||||
|
@ -130,7 +130,7 @@ void __forceinline KICK_VERTEX2()
|
||||||
|
|
||||||
if (++gs.primC >= (int)g_primmult[prim->prim])
|
if (++gs.primC >= (int)g_primmult[prim->prim])
|
||||||
{
|
{
|
||||||
if (NoHighlights(prim->ctxt)) (*ZeroGS::drawfn[prim->prim])();
|
if (NoHighlights(prim->ctxt)) (*drawfn[prim->prim])();
|
||||||
|
|
||||||
gs.primC -= g_primsub[prim->prim];
|
gs.primC -= g_primsub[prim->prim];
|
||||||
}
|
}
|
||||||
|
@ -224,24 +224,24 @@ void tex0Write(int i, const u32 *data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroGS::vb[i].uNextTex0Data[0] = data[0];
|
vb[i].uNextTex0Data[0] = data[0];
|
||||||
ZeroGS::vb[i].uNextTex0Data[1] = data[1];
|
vb[i].uNextTex0Data[1] = data[1];
|
||||||
ZeroGS::vb[i].bNeedTexCheck = 1;
|
vb[i].bNeedTexCheck = 1;
|
||||||
|
|
||||||
// don't update unless necessary
|
// don't update unless necessary
|
||||||
|
|
||||||
if (PSMT_ISCLUT(psm))
|
if (PSMT_ISCLUT(psm))
|
||||||
{
|
{
|
||||||
if (ZeroGS::CheckChangeInClut(data[1], psm))
|
if (CheckChangeInClut(data[1], psm))
|
||||||
{
|
{
|
||||||
// loading clut, so flush whole texture
|
// loading clut, so flush whole texture
|
||||||
ZeroGS::vb[i].FlushTexData();
|
vb[i].FlushTexData();
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if csa is the same!! (ffx bisaid island, grass)
|
// check if csa is the same!! (ffx bisaid island, grass)
|
||||||
else if ((data[1] & CPSM_CSA_BITMASK) != (ZeroGS::vb[i].uCurTex0Data[1] & CPSM_CSA_BITMASK))
|
else if ((data[1] & CPSM_CSA_BITMASK) != (vb[i].uCurTex0Data[1] & CPSM_CSA_BITMASK))
|
||||||
{
|
{
|
||||||
ZeroGS::Flush(i); // flush any previous entries
|
Flush(i); // flush any previous entries
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -249,13 +249,13 @@ void tex0Write(int i, const u32 *data)
|
||||||
void tex2Write(int i, const u32 *data)
|
void tex2Write(int i, const u32 *data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
tex0Info& tex0 = ZeroGS::vb[i].tex0;
|
tex0Info& tex0 = vb[i].tex0;
|
||||||
|
|
||||||
ZeroGS::vb[i].FlushTexData();
|
vb[i].FlushTexData();
|
||||||
|
|
||||||
u32 psm = ZZOglGet_psm_TexBitsFix(data[0]);
|
u32 psm = ZZOglGet_psm_TexBitsFix(data[0]);
|
||||||
|
|
||||||
u32* s_uTex0Data = ZeroGS::vb[i].uCurTex0Data;
|
u32* s_uTex0Data = vb[i].uCurTex0Data;
|
||||||
|
|
||||||
// don't update unless necessary
|
// don't update unless necessary
|
||||||
// if( ZZOglGet_psm_TexBitsFix(*s_uTex0Data) == ZZOglGet_psm_TexBitsFix(data[0]) ) { // psm is the same
|
// if( ZZOglGet_psm_TexBitsFix(*s_uTex0Data) == ZZOglGet_psm_TexBitsFix(data[0]) ) { // psm is the same
|
||||||
|
@ -270,32 +270,32 @@ void tex2Write(int i, const u32 *data)
|
||||||
|
|
||||||
if (tex0.cld != 0)
|
if (tex0.cld != 0)
|
||||||
{
|
{
|
||||||
ZeroGS::texClutWrite(i);
|
texClutWrite(i);
|
||||||
// invalidate to make sure target didn't change!
|
// invalidate to make sure target didn't change!
|
||||||
ZeroGS::vb[i].bVarsTexSync = false;
|
vb[i].bVarsTexSync = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroGS::Flush(i);
|
Flush(i);
|
||||||
|
|
||||||
ZeroGS::vb[i].bVarsTexSync = false;
|
vb[i].bVarsTexSync = false;
|
||||||
ZeroGS::vb[i].bTexConstsSync = false;
|
vb[i].bTexConstsSync = false;
|
||||||
|
|
||||||
s_uTex0Data[0] = (s_uTex0Data[0] & ~0x03f00000) | (psm << 20);
|
s_uTex0Data[0] = (s_uTex0Data[0] & ~0x03f00000) | (psm << 20);
|
||||||
s_uTex0Data[1] = (s_uTex0Data[1] & 0x1f) | (data[1] & ~0x1f);
|
s_uTex0Data[1] = (s_uTex0Data[1] & 0x1f) | (data[1] & ~0x1f);
|
||||||
|
|
||||||
tex0.psm = ZZOglGet_psm_TexBitsFix(data[0]);
|
tex0.psm = ZZOglGet_psm_TexBitsFix(data[0]);
|
||||||
|
|
||||||
if (PSMT_ISCLUT(tex0.psm)) ZeroGS::CluttingForFlushedTex(&tex0, data[1], i);
|
if (PSMT_ISCLUT(tex0.psm)) CluttingForFlushedTex(&tex0, data[1], i);
|
||||||
}
|
}
|
||||||
|
|
||||||
__forceinline void frameWrite(int i, const u32 *data)
|
__forceinline void frameWrite(int i, const u32 *data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
frameInfo& gsfb = ZeroGS::vb[i].gsfb;
|
frameInfo& gsfb = vb[i].gsfb;
|
||||||
|
|
||||||
if ((gsfb.fbp == ZZOglGet_fbp_FrameBitsMult(data[0])) &&
|
if ((gsfb.fbp == ZZOglGet_fbp_FrameBitsMult(data[0])) &&
|
||||||
(gsfb.fbw == ZZOglGet_fbw_FrameBitsMult(data[0])) &&
|
(gsfb.fbw == ZZOglGet_fbw_FrameBitsMult(data[0])) &&
|
||||||
|
@ -305,7 +305,7 @@ __forceinline void frameWrite(int i, const u32 *data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroGS::FlushBoth();
|
FlushBoth();
|
||||||
|
|
||||||
gsfb.fbp = ZZOglGet_fbp_FrameBitsMult(data[0]);
|
gsfb.fbp = ZZOglGet_fbp_FrameBitsMult(data[0]);
|
||||||
gsfb.fbw = ZZOglGet_fbw_FrameBitsMult(data[0]);
|
gsfb.fbw = ZZOglGet_fbw_FrameBitsMult(data[0]);
|
||||||
|
@ -314,17 +314,17 @@ __forceinline void frameWrite(int i, const u32 *data)
|
||||||
gsfb.fbh = ZZOglGet_fbh_FrameBitsCalc(data[0]);
|
gsfb.fbh = ZZOglGet_fbh_FrameBitsCalc(data[0]);
|
||||||
// gsfb.fbhCalc = gsfb.fbh;
|
// gsfb.fbhCalc = gsfb.fbh;
|
||||||
|
|
||||||
ZeroGS::vb[i].bNeedFrameCheck = 1;
|
vb[i].bNeedFrameCheck = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
__forceinline void testWrite(int i, const u32 *data)
|
__forceinline void testWrite(int i, const u32 *data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
pixTest* test = &ZeroGS::vb[i].test;
|
pixTest* test = &vb[i].test;
|
||||||
|
|
||||||
if ((*(u32*)test & 0x0007ffff) == (data[0] & 0x0007ffff)) return;
|
if ((*(u32*)test & 0x0007ffff) == (data[0] & 0x0007ffff)) return;
|
||||||
|
|
||||||
ZeroGS::Flush(i);
|
Flush(i);
|
||||||
|
|
||||||
*(u32*)test = data[0];
|
*(u32*)test = data[0];
|
||||||
|
|
||||||
|
@ -344,11 +344,11 @@ __forceinline
|
||||||
void clampWrite(int i, const u32 *data)
|
void clampWrite(int i, const u32 *data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
clampInfo& clamp = ZeroGS::vb[i].clamp;
|
clampInfo& clamp = vb[i].clamp;
|
||||||
|
|
||||||
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);
|
Flush(i);
|
||||||
s_uClampData[i] = data[0];
|
s_uClampData[i] = data[0];
|
||||||
|
|
||||||
clamp.wms = (data[0]) & 0x3;
|
clamp.wms = (data[0]) & 0x3;
|
||||||
|
@ -358,7 +358,7 @@ void clampWrite(int i, const u32 *data)
|
||||||
clamp.minv = ((data[0] >> 24) & 0xff) | ((data[1] & 0x3) << 8);
|
clamp.minv = ((data[0] >> 24) & 0xff) | ((data[1] & 0x3) << 8);
|
||||||
clamp.maxv = (data[1] >> 2) & 0x3ff;
|
clamp.maxv = (data[1] >> 2) & 0x3ff;
|
||||||
|
|
||||||
ZeroGS::vb[i].bTexConstsSync = false;
|
vb[i].bTexConstsSync = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ void __gifCall GIFRegHandlerPRIM(const u32 *data)
|
||||||
gs._prim[1].prim = (data[0]) & 0x7;
|
gs._prim[1].prim = (data[0]) & 0x7;
|
||||||
gs._prim[1]._val = (data[0] >> 3) & 0xff;
|
gs._prim[1]._val = (data[0] >> 3) & 0xff;
|
||||||
|
|
||||||
ZeroGS::Prim();
|
Prim();
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerRGBAQ(const u32* data)
|
void __gifCall GIFRegHandlerRGBAQ(const u32* data)
|
||||||
|
@ -522,12 +522,12 @@ void __gifCall GIFRegHandlerNOP(const u32* data)
|
||||||
void tex1Write(int i, const u32* data)
|
void tex1Write(int i, const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
tex1Info& tex1 = ZeroGS::vb[i].tex1;
|
tex1Info& tex1 = vb[i].tex1;
|
||||||
|
|
||||||
if (conf.bilinear == 1 && (tex1.mmag != ((data[0] >> 5) & 0x1) || tex1.mmin != ((data[0] >> 6) & 0x7)))
|
if (conf.bilinear == 1 && (tex1.mmag != ((data[0] >> 5) & 0x1) || tex1.mmin != ((data[0] >> 6) & 0x7)))
|
||||||
{
|
{
|
||||||
ZeroGS::Flush(i);
|
Flush(i);
|
||||||
ZeroGS::vb[i].bVarsTexSync = false;
|
vb[i].bVarsTexSync = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
tex1.lcm = (data[0]) & 0x1;
|
tex1.lcm = (data[0]) & 0x1;
|
||||||
|
@ -574,24 +574,24 @@ void __gifCall GIFRegHandlerXYOFFSET_1(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
// eliminator low 4 bits for now
|
// eliminator low 4 bits for now
|
||||||
ZeroGS::vb[0].offset.x = (data[0]) & 0xffff;
|
vb[0].offset.x = (data[0]) & 0xffff;
|
||||||
ZeroGS::vb[0].offset.y = (data[1]) & 0xffff;
|
vb[0].offset.y = (data[1]) & 0xffff;
|
||||||
|
|
||||||
// if( !conf.interlace ) {
|
// if( !conf.interlace ) {
|
||||||
// ZeroGS::vb[0].offset.x &= ~15;
|
// vb[0].offset.x &= ~15;
|
||||||
// ZeroGS::vb[0].offset.y &= ~15;
|
// vb[0].offset.y &= ~15;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerXYOFFSET_2(const u32* data)
|
void __gifCall GIFRegHandlerXYOFFSET_2(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
ZeroGS::vb[1].offset.x = (data[0]) & 0xffff;
|
vb[1].offset.x = (data[0]) & 0xffff;
|
||||||
ZeroGS::vb[1].offset.y = (data[1]) & 0xffff;
|
vb[1].offset.y = (data[1]) & 0xffff;
|
||||||
|
|
||||||
// if( !conf.interlace ) {
|
// if( !conf.interlace ) {
|
||||||
// ZeroGS::vb[1].offset.x &= ~15;
|
// vb[1].offset.x &= ~15;
|
||||||
// ZeroGS::vb[1].offset.y &= ~15;
|
// vb[1].offset.y &= ~15;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,7 +601,7 @@ void __gifCall GIFRegHandlerPRMODECONT(const u32* data)
|
||||||
gs.prac = data[0] & 0x1;
|
gs.prac = data[0] & 0x1;
|
||||||
prim = &gs._prim[gs.prac];
|
prim = &gs._prim[gs.prac];
|
||||||
|
|
||||||
ZeroGS::Prim();
|
Prim();
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerPRMODE(const u32* data)
|
void __gifCall GIFRegHandlerPRMODE(const u32* data)
|
||||||
|
@ -609,15 +609,15 @@ void __gifCall GIFRegHandlerPRMODE(const u32* data)
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
gs._prim[0]._val = (data[0] >> 3) & 0xff;
|
gs._prim[0]._val = (data[0] >> 3) & 0xff;
|
||||||
|
|
||||||
if (gs.prac == 0) ZeroGS::Prim();
|
if (gs.prac == 0) Prim();
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerTEXCLUT(const u32* data)
|
void __gifCall GIFRegHandlerTEXCLUT(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
ZeroGS::vb[0].FlushTexData();
|
vb[0].FlushTexData();
|
||||||
ZeroGS::vb[1].FlushTexData();
|
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;
|
||||||
|
@ -627,9 +627,9 @@ void __gifCall GIFRegHandlerTEXCLUT(const u32* data)
|
||||||
void __gifCall GIFRegHandlerSCANMSK(const u32* data)
|
void __gifCall GIFRegHandlerSCANMSK(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
// ZeroGS::FlushBoth();
|
// FlushBoth();
|
||||||
// ZeroGS::ResolveC(&ZeroGS::vb[0]);
|
// ResolveC(&vb[0]);
|
||||||
// ZeroGS::ResolveZ(&ZeroGS::vb[0]);
|
// ResolveZ(&vb[0]);
|
||||||
|
|
||||||
gs.smask = data[0] & 0x3;
|
gs.smask = data[0] & 0x3;
|
||||||
}
|
}
|
||||||
|
@ -637,7 +637,7 @@ void __gifCall GIFRegHandlerSCANMSK(const u32* data)
|
||||||
void __gifCall GIFRegHandlerMIPTBP1_1(const u32* data)
|
void __gifCall GIFRegHandlerMIPTBP1_1(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
miptbpInfo& miptbp0 = ZeroGS::vb[0].miptbp0;
|
miptbpInfo& miptbp0 = vb[0].miptbp0;
|
||||||
miptbp0.tbp[0] = (data[0]) & 0x3fff;
|
miptbp0.tbp[0] = (data[0]) & 0x3fff;
|
||||||
miptbp0.tbw[0] = (data[0] >> 14) & 0x3f;
|
miptbp0.tbw[0] = (data[0] >> 14) & 0x3f;
|
||||||
miptbp0.tbp[1] = ((data[0] >> 20) & 0xfff) | ((data[1] & 0x3) << 12);
|
miptbp0.tbp[1] = ((data[0] >> 20) & 0xfff) | ((data[1] & 0x3) << 12);
|
||||||
|
@ -649,7 +649,7 @@ void __gifCall GIFRegHandlerMIPTBP1_1(const u32* data)
|
||||||
void __gifCall GIFRegHandlerMIPTBP1_2(const u32* data)
|
void __gifCall GIFRegHandlerMIPTBP1_2(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
miptbpInfo& miptbp0 = ZeroGS::vb[1].miptbp0;
|
miptbpInfo& miptbp0 = vb[1].miptbp0;
|
||||||
miptbp0.tbp[0] = (data[0]) & 0x3fff;
|
miptbp0.tbp[0] = (data[0]) & 0x3fff;
|
||||||
miptbp0.tbw[0] = (data[0] >> 14) & 0x3f;
|
miptbp0.tbw[0] = (data[0] >> 14) & 0x3f;
|
||||||
miptbp0.tbp[1] = ((data[0] >> 20) & 0xfff) | ((data[1] & 0x3) << 12);
|
miptbp0.tbp[1] = ((data[0] >> 20) & 0xfff) | ((data[1] & 0x3) << 12);
|
||||||
|
@ -661,7 +661,7 @@ void __gifCall GIFRegHandlerMIPTBP1_2(const u32* data)
|
||||||
void __gifCall GIFRegHandlerMIPTBP2_1(const u32* data)
|
void __gifCall GIFRegHandlerMIPTBP2_1(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
miptbpInfo& miptbp1 = ZeroGS::vb[0].miptbp1;
|
miptbpInfo& miptbp1 = vb[0].miptbp1;
|
||||||
miptbp1.tbp[0] = (data[0]) & 0x3fff;
|
miptbp1.tbp[0] = (data[0]) & 0x3fff;
|
||||||
miptbp1.tbw[0] = (data[0] >> 14) & 0x3f;
|
miptbp1.tbw[0] = (data[0] >> 14) & 0x3f;
|
||||||
miptbp1.tbp[1] = ((data[0] >> 20) & 0xfff) | ((data[1] & 0x3) << 12);
|
miptbp1.tbp[1] = ((data[0] >> 20) & 0xfff) | ((data[1] & 0x3) << 12);
|
||||||
|
@ -673,7 +673,7 @@ void __gifCall GIFRegHandlerMIPTBP2_1(const u32* data)
|
||||||
void __gifCall GIFRegHandlerMIPTBP2_2(const u32* data)
|
void __gifCall GIFRegHandlerMIPTBP2_2(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
miptbpInfo& miptbp1 = ZeroGS::vb[1].miptbp1;
|
miptbpInfo& miptbp1 = vb[1].miptbp1;
|
||||||
miptbp1.tbp[0] = (data[0]) & 0x3fff;
|
miptbp1.tbp[0] = (data[0]) & 0x3fff;
|
||||||
miptbp1.tbw[0] = (data[0] >> 14) & 0x3f;
|
miptbp1.tbw[0] = (data[0] >> 14) & 0x3f;
|
||||||
miptbp1.tbp[1] = ((data[0] >> 20) & 0xfff) | ((data[1] & 0x3) << 12);
|
miptbp1.tbp[1] = ((data[0] >> 20) & 0xfff) | ((data[1] & 0x3) << 12);
|
||||||
|
@ -692,34 +692,34 @@ void __gifCall GIFRegHandlerTEXA(const u32* data)
|
||||||
|
|
||||||
if (*(u32*)&newinfo != *(u32*)&gs.texa)
|
if (*(u32*)&newinfo != *(u32*)&gs.texa)
|
||||||
{
|
{
|
||||||
ZeroGS::FlushBoth();
|
FlushBoth();
|
||||||
|
|
||||||
*(u32*)&gs.texa = *(u32*) & newinfo;
|
*(u32*)&gs.texa = *(u32*) & newinfo;
|
||||||
|
|
||||||
gs.texa.fta[0] = newinfo.ta[0] / 255.0f;
|
gs.texa.fta[0] = newinfo.ta[0] / 255.0f;
|
||||||
gs.texa.fta[1] = newinfo.ta[1] / 255.0f;
|
gs.texa.fta[1] = newinfo.ta[1] / 255.0f;
|
||||||
|
|
||||||
ZeroGS::vb[0].bTexConstsSync = false;
|
vb[0].bTexConstsSync = false;
|
||||||
ZeroGS::vb[1].bTexConstsSync = false;
|
vb[1].bTexConstsSync = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerFOGCOL(const u32* data)
|
void __gifCall GIFRegHandlerFOGCOL(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
ZeroGS::SetFogColor(data[0]&0xffffff);
|
SetFogColor(data[0]&0xffffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerTEXFLUSH(const u32* data)
|
void __gifCall GIFRegHandlerTEXFLUSH(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
ZeroGS::SetTexFlush();
|
SetTexFlush();
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerSCISSOR_1(const u32* data)
|
void __gifCall GIFRegHandlerSCISSOR_1(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
Rect2& scissor = ZeroGS::vb[0].scissor;
|
Rect2& scissor = vb[0].scissor;
|
||||||
|
|
||||||
Rect2 newscissor;
|
Rect2 newscissor;
|
||||||
|
|
||||||
|
@ -731,16 +731,16 @@ void __gifCall GIFRegHandlerSCISSOR_1(const u32* data)
|
||||||
if (newscissor.x1 != scissor.x1 || newscissor.y1 != scissor.y1 ||
|
if (newscissor.x1 != scissor.x1 || newscissor.y1 != scissor.y1 ||
|
||||||
newscissor.x0 != scissor.x0 || newscissor.y0 != scissor.y0)
|
newscissor.x0 != scissor.x0 || newscissor.y0 != scissor.y0)
|
||||||
{
|
{
|
||||||
ZeroGS::Flush(0);
|
Flush(0);
|
||||||
scissor = newscissor;
|
scissor = newscissor;
|
||||||
ZeroGS::vb[0].bNeedFrameCheck = 1;
|
vb[0].bNeedFrameCheck = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerSCISSOR_2(const u32* data)
|
void __gifCall GIFRegHandlerSCISSOR_2(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
Rect2& scissor = ZeroGS::vb[1].scissor;
|
Rect2& scissor = vb[1].scissor;
|
||||||
|
|
||||||
Rect2 newscissor;
|
Rect2 newscissor;
|
||||||
|
|
||||||
|
@ -752,11 +752,11 @@ void __gifCall GIFRegHandlerSCISSOR_2(const u32* data)
|
||||||
if (newscissor.x1 != scissor.x1 || newscissor.y1 != scissor.y1 ||
|
if (newscissor.x1 != scissor.x1 || newscissor.y1 != scissor.y1 ||
|
||||||
newscissor.x0 != scissor.x0 || newscissor.y0 != scissor.y0)
|
newscissor.x0 != scissor.x0 || newscissor.y0 != scissor.y0)
|
||||||
{
|
{
|
||||||
ZeroGS::Flush(1);
|
Flush(1);
|
||||||
scissor = newscissor;
|
scissor = newscissor;
|
||||||
|
|
||||||
// flush everything
|
// flush everything
|
||||||
ZeroGS::vb[1].bNeedFrameCheck = 1;
|
vb[1].bNeedFrameCheck = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -767,16 +767,16 @@ void __gifCall GIFRegHandlerALPHA_1(const u32* data)
|
||||||
newalpha.abcd = *(u8*)data;
|
newalpha.abcd = *(u8*)data;
|
||||||
newalpha.fix = *(u8*)(data + 1);
|
newalpha.fix = *(u8*)(data + 1);
|
||||||
|
|
||||||
if (*(u16*)&newalpha != *(u16*)&ZeroGS::vb[0].alpha)
|
if (*(u16*)&newalpha != *(u16*)&vb[0].alpha)
|
||||||
{
|
{
|
||||||
ZeroGS::Flush(0);
|
Flush(0);
|
||||||
|
|
||||||
if (newalpha.a == 3) newalpha.a = 0;
|
if (newalpha.a == 3) newalpha.a = 0;
|
||||||
if (newalpha.b == 3) newalpha.b = 0;
|
if (newalpha.b == 3) newalpha.b = 0;
|
||||||
if (newalpha.c == 3) newalpha.c = 0;
|
if (newalpha.c == 3) newalpha.c = 0;
|
||||||
if (newalpha.d == 3) newalpha.d = 0;
|
if (newalpha.d == 3) newalpha.d = 0;
|
||||||
|
|
||||||
*(u16*)&ZeroGS::vb[0].alpha = *(u16*) & newalpha;
|
*(u16*)&vb[0].alpha = *(u16*) & newalpha;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -787,16 +787,16 @@ void __gifCall GIFRegHandlerALPHA_2(const u32* data)
|
||||||
newalpha.abcd = *(u8*)data;
|
newalpha.abcd = *(u8*)data;
|
||||||
newalpha.fix = *(u8*)(data + 1);
|
newalpha.fix = *(u8*)(data + 1);
|
||||||
|
|
||||||
if (*(u16*)&newalpha != *(u16*)&ZeroGS::vb[1].alpha)
|
if (*(u16*)&newalpha != *(u16*)&vb[1].alpha)
|
||||||
{
|
{
|
||||||
ZeroGS::Flush(1);
|
Flush(1);
|
||||||
|
|
||||||
if (newalpha.a == 3) newalpha.a = 0;
|
if (newalpha.a == 3) newalpha.a = 0;
|
||||||
if (newalpha.b == 3) newalpha.b = 0;
|
if (newalpha.b == 3) newalpha.b = 0;
|
||||||
if (newalpha.c == 3) newalpha.c = 0;
|
if (newalpha.c == 3) newalpha.c = 0;
|
||||||
if (newalpha.d == 3) newalpha.d = 0;
|
if (newalpha.d == 3) newalpha.d = 0;
|
||||||
|
|
||||||
*(u16*)&ZeroGS::vb[1].alpha = *(u16*) & newalpha;
|
*(u16*)&vb[1].alpha = *(u16*) & newalpha;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -832,9 +832,9 @@ void __gifCall GIFRegHandlerTEST_2(const u32* data)
|
||||||
void __gifCall GIFRegHandlerPABE(const u32* data)
|
void __gifCall GIFRegHandlerPABE(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
//ZeroGS::SetAlphaChanged(0, GPUREG_PABE);
|
//SetAlphaChanged(0, GPUREG_PABE);
|
||||||
//ZeroGS::SetAlphaChanged(1, GPUREG_PABE);
|
//SetAlphaChanged(1, GPUREG_PABE);
|
||||||
ZeroGS::FlushBoth();
|
FlushBoth();
|
||||||
|
|
||||||
gs.pabe = *data & 0x1;
|
gs.pabe = *data & 0x1;
|
||||||
}
|
}
|
||||||
|
@ -843,17 +843,17 @@ void __gifCall GIFRegHandlerFBA_1(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
ZeroGS::FlushBoth();
|
FlushBoth();
|
||||||
ZeroGS::vb[0].fba.fba = *data & 0x1;
|
vb[0].fba.fba = *data & 0x1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerFBA_2(const u32* data)
|
void __gifCall GIFRegHandlerFBA_2(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
ZeroGS::FlushBoth();
|
FlushBoth();
|
||||||
|
|
||||||
ZeroGS::vb[1].fba.fba = *data & 0x1;
|
vb[1].fba.fba = *data & 0x1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerFRAME_1(const u32* data)
|
void __gifCall GIFRegHandlerFRAME_1(const u32* data)
|
||||||
|
@ -871,7 +871,7 @@ void __gifCall GIFRegHandlerFRAME_2(const u32* data)
|
||||||
void __gifCall GIFRegHandlerZBUF_1(const u32* data)
|
void __gifCall GIFRegHandlerZBUF_1(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
zbufInfo& zbuf = ZeroGS::vb[0].zbuf;
|
zbufInfo& zbuf = vb[0].zbuf;
|
||||||
|
|
||||||
int psm = (0x30 | ((data[0] >> 24) & 0xf));
|
int psm = (0x30 | ((data[0] >> 24) & 0xf));
|
||||||
|
|
||||||
|
@ -885,23 +885,23 @@ void __gifCall GIFRegHandlerZBUF_1(const u32* data)
|
||||||
// error detection
|
// error detection
|
||||||
if (m_Blocks[psm].bpp == 0) return;
|
if (m_Blocks[psm].bpp == 0) return;
|
||||||
|
|
||||||
ZeroGS::FlushBoth();
|
FlushBoth();
|
||||||
|
|
||||||
zbuf.zbp = (data[0] & 0x1ff) * 32;
|
zbuf.zbp = (data[0] & 0x1ff) * 32;
|
||||||
zbuf.psm = 0x30 | ((data[0] >> 24) & 0xf);
|
zbuf.psm = 0x30 | ((data[0] >> 24) & 0xf);
|
||||||
zbuf.zmsk = data[1] & 0x1;
|
zbuf.zmsk = data[1] & 0x1;
|
||||||
|
|
||||||
ZeroGS::vb[0].zprimmask = 0xffffffff;
|
vb[0].zprimmask = 0xffffffff;
|
||||||
|
|
||||||
if (zbuf.psm > 0x31) ZeroGS::vb[0].zprimmask = 0xffff;
|
if (zbuf.psm > 0x31) vb[0].zprimmask = 0xffff;
|
||||||
|
|
||||||
ZeroGS::vb[0].bNeedZCheck = 1;
|
vb[0].bNeedZCheck = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerZBUF_2(const u32* data)
|
void __gifCall GIFRegHandlerZBUF_2(const u32* data)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
zbufInfo& zbuf = ZeroGS::vb[1].zbuf;
|
zbufInfo& zbuf = vb[1].zbuf;
|
||||||
|
|
||||||
int psm = (0x30 | ((data[0] >> 24) & 0xf));
|
int psm = (0x30 | ((data[0] >> 24) & 0xf));
|
||||||
|
|
||||||
|
@ -915,7 +915,7 @@ void __gifCall GIFRegHandlerZBUF_2(const u32* data)
|
||||||
// error detection
|
// error detection
|
||||||
if (m_Blocks[psm].bpp == 0) return;
|
if (m_Blocks[psm].bpp == 0) return;
|
||||||
|
|
||||||
ZeroGS::FlushBoth();
|
FlushBoth();
|
||||||
|
|
||||||
zbuf.zbp = (data[0] & 0x1ff) * 32;
|
zbuf.zbp = (data[0] & 0x1ff) * 32;
|
||||||
|
|
||||||
|
@ -923,10 +923,10 @@ void __gifCall GIFRegHandlerZBUF_2(const u32* data)
|
||||||
|
|
||||||
zbuf.zmsk = data[1] & 0x1;
|
zbuf.zmsk = data[1] & 0x1;
|
||||||
|
|
||||||
ZeroGS::vb[1].bNeedZCheck = 1;
|
vb[1].bNeedZCheck = 1;
|
||||||
ZeroGS::vb[1].zprimmask = 0xffffffff;
|
vb[1].zprimmask = 0xffffffff;
|
||||||
|
|
||||||
if (zbuf.psm > 0x31) ZeroGS::vb[1].zprimmask = 0xffff;
|
if (zbuf.psm > 0x31) vb[1].zprimmask = 0xffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerBITBLTBUF(const u32* data)
|
void __gifCall GIFRegHandlerBITBLTBUF(const u32* data)
|
||||||
|
@ -973,7 +973,7 @@ void __gifCall GIFRegHandlerTRXDIR(const u32* data)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // loc->host
|
case 1: // loc->host
|
||||||
ZeroGS::TerminateLocalHost();
|
TerminateLocalHost();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -990,15 +990,15 @@ void __gifCall GIFRegHandlerTRXDIR(const u32* data)
|
||||||
switch (gs.imageTransfer)
|
switch (gs.imageTransfer)
|
||||||
{
|
{
|
||||||
case 0: // host->loc
|
case 0: // host->loc
|
||||||
ZeroGS::InitTransferHostLocal();
|
InitTransferHostLocal();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // loc->host
|
case 1: // loc->host
|
||||||
ZeroGS::InitTransferLocalHost();
|
InitTransferLocalHost();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
ZeroGS::TransferLocalLocal();
|
TransferLocalLocal();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -1024,7 +1024,7 @@ void __gifCall GIFRegHandlerHWREG(const u32* data)
|
||||||
|
|
||||||
if (gs.imageTransfer == 0)
|
if (gs.imageTransfer == 0)
|
||||||
{
|
{
|
||||||
ZeroGS::TransferHostLocal(data, 2);
|
TransferHostLocal(data, 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,7 +86,7 @@ void ProcessAASetting(bool reverse)
|
||||||
conf.incAA();
|
conf.incAA();
|
||||||
|
|
||||||
sprintf(strtitle, "anti-aliasing - %s", s_aa[conf.aa]);
|
sprintf(strtitle, "anti-aliasing - %s", s_aa[conf.aa]);
|
||||||
ZeroGS::SetAA(conf.aa);
|
SetAA(conf.aa);
|
||||||
ZZLog::WriteToScreen(strtitle);
|
ZZLog::WriteToScreen(strtitle);
|
||||||
|
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
|
@ -286,7 +286,7 @@ void ProcessEvents()
|
||||||
{
|
{
|
||||||
// destroy that msg
|
// destroy that msg
|
||||||
conf.setFullscreen(false);
|
conf.setFullscreen(false);
|
||||||
ZeroGS::ChangeDeviceSize(conf.width, conf.height);
|
ChangeDeviceSize(conf.width, conf.height);
|
||||||
UpdateWindow(GShwnd);
|
UpdateWindow(GShwnd);
|
||||||
continue; // so that msg doesn't get sent
|
continue; // so that msg doesn't get sent
|
||||||
}
|
}
|
||||||
|
@ -315,7 +315,7 @@ void ProcessEvents()
|
||||||
{
|
{
|
||||||
conf.zz_options.fullscreen = !conf.zz_options.fullscreen;
|
conf.zz_options.fullscreen = !conf.zz_options.fullscreen;
|
||||||
|
|
||||||
ZeroGS::SetChangeDeviceSize(
|
SetChangeDeviceSize(
|
||||||
(conf.fullscreen()) ? 1280 : conf.width,
|
(conf.fullscreen()) ? 1280 : conf.width,
|
||||||
(conf.fullscreen()) ? 960 : conf.height);
|
(conf.fullscreen()) ? 960 : conf.height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ void SetDir(const char* dir)
|
||||||
|
|
||||||
void WriteToScreen(const char* pstr, u32 ms)
|
void WriteToScreen(const char* pstr, u32 ms)
|
||||||
{
|
{
|
||||||
ZeroGS::AddMessage(pstr, ms);
|
ZZAddMessage(pstr, ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _Message(const char *str)
|
void _Message(const char *str)
|
||||||
|
|
|
@ -99,7 +99,7 @@ static bool SPAM_PASS;
|
||||||
if( err != GL_NO_ERROR ) \
|
if( err != GL_NO_ERROR ) \
|
||||||
{ \
|
{ \
|
||||||
ZZLog::Error_Log("%s:%d: gl error %s(0x%x)", __FILE__, (int)__LINE__, error_name(err), err); \
|
ZZLog::Error_Log("%s:%d: gl error %s(0x%x)", __FILE__, (int)__LINE__, error_name(err), err); \
|
||||||
ZeroGS::HandleGLError(); \
|
HandleGLError(); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ static bool SPAM_PASS;
|
||||||
if( err != GL_NO_ERROR ) \
|
if( err != GL_NO_ERROR ) \
|
||||||
{ \
|
{ \
|
||||||
ZZLog::Error_Log("%s:%d: gl error %s (0x%x)", __FILE__, (int)__LINE__, error_name(err), err); \
|
ZZLog::Error_Log("%s:%d: gl error %s (0x%x)", __FILE__, (int)__LINE__, error_name(err), err); \
|
||||||
ZeroGS::HandleGLError(); \
|
HandleGLError(); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -156,16 +156,13 @@ inline const char *error_name(int err)
|
||||||
|
|
||||||
extern void __LogToConsole(const char *fmt, ...);
|
extern void __LogToConsole(const char *fmt, ...);
|
||||||
|
|
||||||
// Subset of zerogs, to avoid that whole huge header.
|
extern void ZZAddMessage(const char* pstr, u32 ms);
|
||||||
namespace ZeroGS
|
|
||||||
{
|
|
||||||
extern void AddMessage(const char* pstr, u32 ms);
|
|
||||||
extern void SetAA(int mode);
|
extern void SetAA(int mode);
|
||||||
extern bool Create(int width, int height);
|
extern bool ZZCreate(int width, int height);
|
||||||
extern void Destroy(bool bD3D);
|
extern void ZZDestroy(bool bD3D);
|
||||||
extern void StartCapture();
|
extern void StartCapture();
|
||||||
extern void StopCapture();
|
extern void StopCapture();
|
||||||
}
|
|
||||||
|
|
||||||
namespace ZZLog
|
namespace ZZLog
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,8 +25,6 @@
|
||||||
#include "GLWin.h"
|
#include "GLWin.h"
|
||||||
#include "ZZoglShaders.h"
|
#include "ZZoglShaders.h"
|
||||||
|
|
||||||
using namespace ZeroGS;
|
|
||||||
|
|
||||||
//------------------ Defines
|
//------------------ Defines
|
||||||
#if !defined(ZEROGS_DEVBUILD)
|
#if !defined(ZEROGS_DEVBUILD)
|
||||||
#define g_bSaveFrame 0
|
#define g_bSaveFrame 0
|
||||||
|
@ -50,7 +48,7 @@ extern bool g_bMakeSnapshot;
|
||||||
extern string strSnapshot;
|
extern string strSnapshot;
|
||||||
|
|
||||||
// Adjusts vertex shader BitBltPos vector v to preserve aspect ratio. It used to emulate 4:3 or 16:9.
|
// Adjusts vertex shader BitBltPos vector v to preserve aspect ratio. It used to emulate 4:3 or 16:9.
|
||||||
void ZeroGS::AdjustTransToAspect(float4& v)
|
void AdjustTransToAspect(float4& v)
|
||||||
{
|
{
|
||||||
double temp;
|
double temp;
|
||||||
float f;
|
float f;
|
||||||
|
@ -670,7 +668,7 @@ inline void AfterRenderMadeSnapshoot()
|
||||||
{
|
{
|
||||||
char str[255];
|
char str[255];
|
||||||
sprintf(str, "saved %s\n", strSnapshot.c_str());
|
sprintf(str, "saved %s\n", strSnapshot.c_str());
|
||||||
AddMessage(str, 500);
|
ZZAddMessage(str, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_bMakeSnapshot = false;
|
g_bMakeSnapshot = false;
|
||||||
|
@ -679,7 +677,7 @@ inline void AfterRenderMadeSnapshoot()
|
||||||
// If needed reset
|
// If needed reset
|
||||||
inline void AfterRendererResizeWindow()
|
inline void AfterRendererResizeWindow()
|
||||||
{
|
{
|
||||||
Reset();
|
ZZReset();
|
||||||
ChangeDeviceSize(s_nNewWidth, s_nNewHeight);
|
ChangeDeviceSize(s_nNewWidth, s_nNewHeight);
|
||||||
s_nNewWidth = s_nNewHeight = -1;
|
s_nNewWidth = s_nNewHeight = -1;
|
||||||
}
|
}
|
||||||
|
@ -823,7 +821,7 @@ inline void AfterRendererAutoresetTargets()
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
// The main renderer function
|
// The main renderer function
|
||||||
void ZeroGS::RenderCRTC(int interlace)
|
void RenderCRTC(int interlace)
|
||||||
{
|
{
|
||||||
if (FrameSkippingHelper()) return;
|
if (FrameSkippingHelper()) return;
|
||||||
|
|
||||||
|
|
|
@ -56,8 +56,6 @@ extern int g_nDepthUsed; // ffx2 pal movies
|
||||||
|
|
||||||
extern u32 s_ptexInterlace; // holds interlace fields
|
extern u32 s_ptexInterlace; // holds interlace fields
|
||||||
|
|
||||||
namespace ZeroGS
|
|
||||||
{
|
|
||||||
extern int s_nNewWidth, s_nNewHeight;
|
extern int s_nNewWidth, s_nNewHeight;
|
||||||
|
|
||||||
extern CRangeManager s_RangeMngr; // manages overwritten memory
|
extern CRangeManager s_RangeMngr; // manages overwritten memory
|
||||||
|
@ -95,6 +93,5 @@ inline u32 CreateInterlaceTex(int width)
|
||||||
|
|
||||||
return s_ptexInterlace;
|
return s_ptexInterlace;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#endif // ZZOGLCRTC_H_INCLUDED
|
#endif // ZZOGLCRTC_H_INCLUDED
|
||||||
|
|
|
@ -73,8 +73,6 @@ typedef void (APIENTRYP _PFNSWAPINTERVAL)(int);
|
||||||
|
|
||||||
map<string, GLbyte> mapGLExtensions;
|
map<string, GLbyte> mapGLExtensions;
|
||||||
|
|
||||||
namespace ZeroGS
|
|
||||||
{
|
|
||||||
extern void KickPoint();
|
extern void KickPoint();
|
||||||
extern void KickLine();
|
extern void KickLine();
|
||||||
extern void KickTriangle();
|
extern void KickTriangle();
|
||||||
|
@ -92,7 +90,6 @@ int g_nCurVBOIndex = 0;
|
||||||
inline bool CreateImportantCheck();
|
inline bool CreateImportantCheck();
|
||||||
inline void CreateOtherCheck();
|
inline void CreateOtherCheck();
|
||||||
inline bool CreateOpenShadersFile();
|
inline bool CreateOpenShadersFile();
|
||||||
}
|
|
||||||
|
|
||||||
//------------------ Dummies
|
//------------------ Dummies
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -136,8 +133,6 @@ char* EFFECT_DIR = "";
|
||||||
|
|
||||||
/////////////////////
|
/////////////////////
|
||||||
// graphics resources
|
// graphics resources
|
||||||
FRAGMENTSHADER ppsRegular[4], ppsTexture[NUM_SHADERS];
|
|
||||||
FRAGMENTSHADER ppsCRTC[2], ppsCRTC24[2], ppsCRTCTarg[2];
|
|
||||||
GLenum s_srcrgb, s_dstrgb, s_srcalpha, s_dstalpha; // set by zgsBlendFuncSeparateEXT
|
GLenum s_srcrgb, s_dstrgb, s_srcalpha, s_dstalpha; // set by zgsBlendFuncSeparateEXT
|
||||||
u32 s_stencilfunc, s_stencilref, s_stencilmask;
|
u32 s_stencilfunc, s_stencilref, s_stencilmask;
|
||||||
GLenum s_drawbuffers[] = { GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT };
|
GLenum s_drawbuffers[] = { GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT };
|
||||||
|
@ -168,12 +163,12 @@ int g_nDepthBias = 0;
|
||||||
|
|
||||||
//------------------ Code
|
//------------------ Code
|
||||||
|
|
||||||
bool ZeroGS::IsGLExt(const char* szTargetExtension)
|
bool IsGLExt(const char* szTargetExtension)
|
||||||
{
|
{
|
||||||
return mapGLExtensions.find(string(szTargetExtension)) != mapGLExtensions.end();
|
return mapGLExtensions.find(string(szTargetExtension)) != mapGLExtensions.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool ZeroGS::Create_Window(int _width, int _height)
|
inline bool Create_Window(int _width, int _height)
|
||||||
{
|
{
|
||||||
nBackbufferWidth = _width;
|
nBackbufferWidth = _width;
|
||||||
nBackbufferHeight = _height;
|
nBackbufferHeight = _height;
|
||||||
|
@ -188,7 +183,7 @@ inline bool ZeroGS::Create_Window(int _width, int _height)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function asks about different OGL extensions, that are required to setup accordingly. Return false if checks failed
|
// Function asks about different OGL extensions, that are required to setup accordingly. Return false if checks failed
|
||||||
inline bool ZeroGS::CreateImportantCheck()
|
inline bool CreateImportantCheck()
|
||||||
{
|
{
|
||||||
bool bSuccess = true;
|
bool bSuccess = true;
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
@ -220,7 +215,7 @@ inline bool ZeroGS::CreateImportantCheck()
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is a check for less important open gl extensions.
|
// This is a check for less important open gl extensions.
|
||||||
inline void ZeroGS::CreateOtherCheck()
|
inline void CreateOtherCheck()
|
||||||
{
|
{
|
||||||
if (!IsGLExt("GL_EXT_blend_equation_separate") || glBlendEquationSeparateEXT == NULL)
|
if (!IsGLExt("GL_EXT_blend_equation_separate") || glBlendEquationSeparateEXT == NULL)
|
||||||
{
|
{
|
||||||
|
@ -294,7 +289,7 @@ inline void ZeroGS::CreateOtherCheck()
|
||||||
|
|
||||||
// open shader file according to build target
|
// open shader file according to build target
|
||||||
|
|
||||||
inline bool ZeroGS::CreateOpenShadersFile()
|
inline bool CreateOpenShadersFile()
|
||||||
{
|
{
|
||||||
#ifndef DEVBUILD
|
#ifndef DEVBUILD
|
||||||
# ifdef _WIN32
|
# ifdef _WIN32
|
||||||
|
@ -445,20 +440,20 @@ inline bool TryBlinearFormat(GLint fmt32, GLint fmt16, const GLvoid* vBilinearDa
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ZeroGS::Create(int _width, int _height)
|
bool ZZCreate(int _width, int _height)
|
||||||
{
|
{
|
||||||
GLenum err = GL_NO_ERROR;
|
GLenum err = GL_NO_ERROR;
|
||||||
bool bSuccess = true;
|
bool bSuccess = true;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
Destroy(1);
|
ZZDestroy(1);
|
||||||
GSStateReset();
|
ZZGSStateReset();
|
||||||
|
|
||||||
if (!Create_Window(_width, _height)) return false;
|
if (!Create_Window(_width, _height)) return false;
|
||||||
if (!CreateFillExtensionsMap()) return false;
|
if (!CreateFillExtensionsMap()) return false;
|
||||||
if (!CreateImportantCheck()) return false;
|
if (!CreateImportantCheck()) return false;
|
||||||
|
|
||||||
ZeroGS::CreateOtherCheck();
|
CreateOtherCheck();
|
||||||
|
|
||||||
// check the max texture width and height
|
// check the max texture width and height
|
||||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &g_MaxTexWidth);
|
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &g_MaxTexWidth);
|
||||||
|
@ -793,7 +788,7 @@ bool ZeroGS::Create(int _width, int _height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::Destroy(bool bD3D)
|
void ZZDestroy(bool bD3D)
|
||||||
{
|
{
|
||||||
Delete_Avi_Capture();
|
Delete_Avi_Capture();
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
#include "ZZoglFlushHack.h"
|
#include "ZZoglFlushHack.h"
|
||||||
#include "ZZoglShaders.h"
|
#include "ZZoglShaders.h"
|
||||||
|
|
||||||
using namespace ZeroGS;
|
|
||||||
|
|
||||||
//------------------ Defines
|
//------------------ Defines
|
||||||
#ifndef ZEROGS_DEVBUILD
|
#ifndef ZEROGS_DEVBUILD
|
||||||
|
|
||||||
|
@ -193,9 +191,6 @@ int s_nWireframeCount = 0;
|
||||||
|
|
||||||
//------------------ Namespace
|
//------------------ Namespace
|
||||||
|
|
||||||
namespace ZeroGS
|
|
||||||
{
|
|
||||||
|
|
||||||
VB vb[2];
|
VB vb[2];
|
||||||
float fiTexWidth[2], fiTexHeight[2]; // current tex width and height
|
float fiTexWidth[2], fiTexHeight[2]; // current tex width and height
|
||||||
|
|
||||||
|
@ -221,9 +216,6 @@ inline void ProcessStencil(const VB& curvb);
|
||||||
inline void RenderFBA(const VB& curvb, ZZshParameter sOneColor);
|
inline void RenderFBA(const VB& curvb, ZZshParameter sOneColor);
|
||||||
inline void ProcessFBA(const VB& curvb, ZZshParameter sOneColor); // zz
|
inline void ProcessFBA(const VB& curvb, ZZshParameter sOneColor); // zz
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------ Code
|
//------------------ Code
|
||||||
|
|
||||||
inline float AlphaReferedValue(int aref)
|
inline float AlphaReferedValue(int aref)
|
||||||
|
@ -299,7 +291,7 @@ int GetTexFilter(const tex1Info& tex1)
|
||||||
return texfilter;
|
return texfilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::ReloadEffects()
|
void ReloadEffects()
|
||||||
{
|
{
|
||||||
#ifdef ZEROGS_DEVBUILD
|
#ifdef ZEROGS_DEVBUILD
|
||||||
|
|
||||||
|
@ -321,7 +313,7 @@ inline void VisualBufferMessage(int context)
|
||||||
{
|
{
|
||||||
#if defined(WRITE_PRIM_LOGS) && defined(_DEBUG)
|
#if defined(WRITE_PRIM_LOGS) && defined(_DEBUG)
|
||||||
BufferNumber++;
|
BufferNumber++;
|
||||||
ZeroGS::VB& curvb = vb[context];
|
VB& curvb = vb[context];
|
||||||
static const char* patst[8] = { "NEVER", "ALWAYS", "LESS", "LEQUAL", "EQUAL", "GEQUAL", "GREATER", "NOTEQUAL"};
|
static const char* patst[8] = { "NEVER", "ALWAYS", "LESS", "LEQUAL", "EQUAL", "GEQUAL", "GREATER", "NOTEQUAL"};
|
||||||
static const char* pztst[4] = { "NEVER", "ALWAYS", "GEQUAL", "GREATER" };
|
static const char* pztst[4] = { "NEVER", "ALWAYS", "GEQUAL", "GREATER" };
|
||||||
static const char* pafail[4] = { "KEEP", "FB_ONLY", "ZB_ONLY", "RGB_ONLY" };
|
static const char* pafail[4] = { "KEEP", "FB_ONLY", "ZB_ONLY", "RGB_ONLY" };
|
||||||
|
@ -1477,7 +1469,7 @@ inline void FlushUndoFiter(u32 dwFilterOpts)
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is the most important function! It draws all collected info onscreen.
|
// This is the most important function! It draws all collected info onscreen.
|
||||||
void ZeroGS::Flush(int context)
|
void Flush(int context)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
VB& curvb = vb[context];
|
VB& curvb = vb[context];
|
||||||
|
@ -1535,13 +1527,13 @@ void ZeroGS::Flush(int context)
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::FlushBoth()
|
void FlushBoth()
|
||||||
{
|
{
|
||||||
Flush(0);
|
Flush(0);
|
||||||
Flush(1);
|
Flush(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void ZeroGS::RenderFBA(const VB& curvb, ZZshParameter sOneColor)
|
inline void RenderFBA(const VB& curvb, ZZshParameter sOneColor)
|
||||||
{
|
{
|
||||||
// add fba to all pixels
|
// add fba to all pixels
|
||||||
GL_STENCILFUNC(GL_ALWAYS, STENCIL_FBA, 0xff);
|
GL_STENCILFUNC(GL_ALWAYS, STENCIL_FBA, 0xff);
|
||||||
|
@ -1585,7 +1577,7 @@ inline void ZeroGS::RenderFBA(const VB& curvb, ZZshParameter sOneColor)
|
||||||
GL_ZTEST(curvb.test.zte);
|
GL_ZTEST(curvb.test.zte);
|
||||||
}
|
}
|
||||||
|
|
||||||
__forceinline void ZeroGS::RenderAlphaTest(const VB& curvb, ZZshParameter sOneColor)
|
__forceinline void RenderAlphaTest(const VB& curvb, ZZshParameter sOneColor)
|
||||||
{
|
{
|
||||||
if (!g_bUpdateStencil) return;
|
if (!g_bUpdateStencil) return;
|
||||||
|
|
||||||
|
@ -1653,7 +1645,7 @@ __forceinline void ZeroGS::RenderAlphaTest(const VB& curvb, ZZshParameter sOneCo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void ZeroGS::RenderStencil(const VB& curvb, u32 dwUsingSpecialTesting)
|
inline void RenderStencil(const VB& curvb, u32 dwUsingSpecialTesting)
|
||||||
{
|
{
|
||||||
//NOTE: This stencil hack for dest alpha testing ONLY works when
|
//NOTE: This stencil hack for dest alpha testing ONLY works when
|
||||||
// the geometry in one DrawPrimitive call does not overlap
|
// the geometry in one DrawPrimitive call does not overlap
|
||||||
|
@ -1670,7 +1662,7 @@ inline void ZeroGS::RenderStencil(const VB& curvb, u32 dwUsingSpecialTesting)
|
||||||
GL_STENCILFUNC_SET();
|
GL_STENCILFUNC_SET();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void ZeroGS::ProcessStencil(const VB& curvb)
|
inline void ProcessStencil(const VB& curvb)
|
||||||
{
|
{
|
||||||
assert(!curvb.fba.fba);
|
assert(!curvb.fba.fba);
|
||||||
|
|
||||||
|
@ -1723,7 +1715,7 @@ inline void ZeroGS::ProcessStencil(const VB& curvb)
|
||||||
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
||||||
}
|
}
|
||||||
|
|
||||||
__forceinline void ZeroGS::ProcessFBA(const VB& curvb, ZZshParameter sOneColor)
|
__forceinline void ProcessFBA(const VB& curvb, ZZshParameter sOneColor)
|
||||||
{
|
{
|
||||||
if ((curvb.frame.fbm&0x80000000)) return;
|
if ((curvb.frame.fbm&0x80000000)) return;
|
||||||
|
|
||||||
|
@ -1784,7 +1776,7 @@ __forceinline void ZeroGS::ProcessFBA(const VB& curvb, ZZshParameter sOneColor)
|
||||||
GL_ZTEST(curvb.test.zte);
|
GL_ZTEST(curvb.test.zte);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::SetContextTarget(int context)
|
void SetContextTarget(int context)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
VB& curvb = vb[context];
|
VB& curvb = vb[context];
|
||||||
|
@ -1859,7 +1851,7 @@ void ZeroGS::SetContextTarget(int context)
|
||||||
//if( bSetTarg && ((vb[0].pdepth != vb[1].pdepth && vb[!context].bVarsSetTarg) || !vb[context].bVarsSetTarg) )
|
//if( bSetTarg && ((vb[0].pdepth != vb[1].pdepth && vb[!context].bVarsSetTarg) || !vb[context].bVarsSetTarg) )
|
||||||
curvb.pdepth->SetDepthStencilSurface();
|
curvb.pdepth->SetDepthStencilSurface();
|
||||||
|
|
||||||
if (conf.mrtdepth && ZeroGS::IsWriteDepth()) curvb.pdepth->SetRenderTarget(1);
|
if (conf.mrtdepth && IsWriteDepth()) curvb.pdepth->SetRenderTarget(1);
|
||||||
if (s_ptexCurSet[0] == curvb.prndr->ptex) s_ptexCurSet[0] = 0;
|
if (s_ptexCurSet[0] == curvb.prndr->ptex) s_ptexCurSet[0] = 0;
|
||||||
if (s_ptexCurSet[1] == curvb.prndr->ptex) s_ptexCurSet[1] = 0;
|
if (s_ptexCurSet[1] == curvb.prndr->ptex) s_ptexCurSet[1] = 0;
|
||||||
|
|
||||||
|
@ -1892,7 +1884,7 @@ void ZeroGS::SetContextTarget(int context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ZeroGS::SetTexInt(int context, FRAGMENTSHADER* pfragment, int settexint)
|
void SetTexInt(int context, FRAGMENTSHADER* pfragment, int settexint)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -1929,14 +1921,14 @@ void SetTexClamping(int context, FRAGMENTSHADER* pfragment)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
SetShaderCaller("SetTexClamping");
|
SetShaderCaller("SetTexClamping");
|
||||||
clampInfo* pclamp = &ZeroGS::vb[context].clamp;
|
clampInfo* pclamp = &vb[context].clamp;
|
||||||
float4 v, v2;
|
float4 v, v2;
|
||||||
v.x = v.y = 0;
|
v.x = v.y = 0;
|
||||||
u32* ptex = ZeroGS::vb[context].ptexClamp;
|
u32* ptex = vb[context].ptexClamp;
|
||||||
ptex[0] = ptex[1] = 0;
|
ptex[0] = ptex[1] = 0;
|
||||||
|
|
||||||
float fw = ZeroGS::vb[context].tex0.tw ;
|
float fw = vb[context].tex0.tw ;
|
||||||
float fh = ZeroGS::vb[context].tex0.th ;
|
float fh = vb[context].tex0.th ;
|
||||||
|
|
||||||
switch (pclamp->wms)
|
switch (pclamp->wms)
|
||||||
{
|
{
|
||||||
|
@ -1966,7 +1958,7 @@ void SetTexClamping(int context, FRAGMENTSHADER* pfragment)
|
||||||
if (correctMinu != g_PrevBitwiseTexX)
|
if (correctMinu != g_PrevBitwiseTexX)
|
||||||
{
|
{
|
||||||
g_PrevBitwiseTexX = correctMinu;
|
g_PrevBitwiseTexX = correctMinu;
|
||||||
ptex[0] = ZeroGS::s_BitwiseTextures.GetTex(correctMinu, 0);
|
ptex[0] = s_BitwiseTextures.GetTex(correctMinu, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -2001,7 +1993,7 @@ void SetTexClamping(int context, FRAGMENTSHADER* pfragment)
|
||||||
if (correctMinv != g_PrevBitwiseTexY)
|
if (correctMinv != g_PrevBitwiseTexY)
|
||||||
{
|
{
|
||||||
g_PrevBitwiseTexY = correctMinv;
|
g_PrevBitwiseTexY = correctMinv;
|
||||||
ptex[1] = ZeroGS::s_BitwiseTextures.GetTex(correctMinv, ptex[0]);
|
ptex[1] = s_BitwiseTextures.GetTex(correctMinv, ptex[0]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2025,7 +2017,7 @@ inline bool equal_vectors(float4 a, float4 b)
|
||||||
}
|
}
|
||||||
|
|
||||||
int CheckTexArray[4][2][2][2] = {{{{0, }}}};
|
int CheckTexArray[4][2][2][2] = {{{{0, }}}};
|
||||||
void ZeroGS::SetTexVariables(int context, FRAGMENTSHADER* pfragment)
|
void SetTexVariables(int context, FRAGMENTSHADER* pfragment)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -2203,7 +2195,7 @@ void ZeroGS::SetTexVariables(int context, FRAGMENTSHADER* pfragment)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0, bool CheckVB, FRAGMENTSHADER* pfragment, int force)
|
void SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0, bool CheckVB, FRAGMENTSHADER* pfragment, int force)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
float4 v;
|
float4 v;
|
||||||
|
@ -2368,11 +2360,11 @@ void ZeroGS::SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0,
|
||||||
// } \
|
// } \
|
||||||
// else { \
|
// else { \
|
||||||
|
|
||||||
void ZeroGS::ResetAlphaVariables() {
|
void ResetAlphaVariables() {
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void ZeroGS::NeedFactor(int w)
|
inline void NeedFactor(int w)
|
||||||
{
|
{
|
||||||
if (bDestAlphaColor == 2)
|
if (bDestAlphaColor == 2)
|
||||||
{
|
{
|
||||||
|
@ -2384,7 +2376,7 @@ inline void ZeroGS::NeedFactor(int w)
|
||||||
|
|
||||||
//static int CheckArray[48][2] = {{0,}};
|
//static int CheckArray[48][2] = {{0,}};
|
||||||
|
|
||||||
void ZeroGS::SetAlphaVariables(const alphaInfo& a)
|
void SetAlphaVariables(const alphaInfo& a)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
bool alphaenable = true;
|
bool alphaenable = true;
|
||||||
|
@ -2877,7 +2869,7 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a)
|
||||||
INC_ALPHAVARS();
|
INC_ALPHAVARS();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::SetWriteDepth()
|
void SetWriteDepth()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -2888,26 +2880,26 @@ void ZeroGS::SetWriteDepth()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZeroGS::IsWriteDepth()
|
bool IsWriteDepth()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
return s_bWriteDepth;
|
return s_bWriteDepth;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZeroGS::IsWriteDestAlphaTest()
|
bool IsWriteDestAlphaTest()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
return s_bDestAlphaTest;
|
return s_bDestAlphaTest;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::SetDestAlphaTest()
|
void SetDestAlphaTest()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
s_bDestAlphaTest = true;
|
s_bDestAlphaTest = true;
|
||||||
s_nWriteDestAlphaTest = 4;
|
s_nWriteDestAlphaTest = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::SetTexFlush()
|
void SetTexFlush()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
s_bTexFlush = true;
|
s_bTexFlush = true;
|
||||||
|
|
|
@ -464,7 +464,7 @@ static const u32 MAX_FRAMES = 500;
|
||||||
static GSFrameInfo FrameAppear[MAX_FRAMES];
|
static GSFrameInfo FrameAppear[MAX_FRAMES];
|
||||||
static u32 Rec_Numbers = 0;
|
static u32 Rec_Numbers = 0;
|
||||||
|
|
||||||
void RecordNewFrames(ZeroGS::VB& curvb, GSFrameInfo fi) {
|
void RecordNewFrames(VB& curvb, GSFrameInfo fi) {
|
||||||
if (Rec_Numbers >= MAX_FRAMES)
|
if (Rec_Numbers >= MAX_FRAMES)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -486,12 +486,12 @@ void RecordNewFrames(ZeroGS::VB& curvb, GSFrameInfo fi) {
|
||||||
// Dump a nice picture of the frame
|
// Dump a nice picture of the frame
|
||||||
char filename[255];
|
char filename[255];
|
||||||
sprintf(filename, "SkipFlushFrame_%d__%d.tga", g_SkipFlushFrame, Rec_Numbers);
|
sprintf(filename, "SkipFlushFrame_%d__%d.tga", g_SkipFlushFrame, Rec_Numbers);
|
||||||
ZeroGS::SaveRenderTarget(filename, curvb.prndr->fbw, curvb.prndr->fbh, 0);
|
SaveRenderTarget(filename, curvb.prndr->fbw, curvb.prndr->fbh, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__forceinline bool IsBadFrame(ZeroGS::VB& curvb)
|
__forceinline bool IsBadFrame(VB& curvb)
|
||||||
{
|
{
|
||||||
GSFrameInfo fi;
|
GSFrameInfo fi;
|
||||||
|
|
||||||
|
|
|
@ -79,5 +79,5 @@ void GSC_StarOcean3(const GSFrameInfo& fi, int& skip);
|
||||||
void GSC_ValkyrieProfile2(const GSFrameInfo& fi, int& skip);
|
void GSC_ValkyrieProfile2(const GSFrameInfo& fi, int& skip);
|
||||||
void GSC_RadiataStories(const GSFrameInfo& fi, int& skip);
|
void GSC_RadiataStories(const GSFrameInfo& fi, int& skip);
|
||||||
|
|
||||||
extern bool IsBadFrame(ZeroGS::VB& curvb);
|
extern bool IsBadFrame(VB& curvb);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -44,7 +44,7 @@ char *libraryNameX = "ZeroGS Playground OpenGL ";
|
||||||
extern char *libraryName;
|
extern char *libraryName;
|
||||||
extern u32 s_uTex1Data[2][2], s_uClampData[2];
|
extern u32 s_uTex1Data[2][2], s_uClampData[2];
|
||||||
|
|
||||||
int ZeroGS::Save(s8* pbydata)
|
int ZZSave(s8* pbydata)
|
||||||
{
|
{
|
||||||
if (pbydata == NULL)
|
if (pbydata == NULL)
|
||||||
return 40 + MEMORY_END + sizeof(gs) + 2*VBSAVELIMIT + 2*sizeof(frameInfo) + 4 + 256*4;
|
return 40 + MEMORY_END + sizeof(gs) + 2*VBSAVELIMIT + 2*sizeof(frameInfo) + 4 + 256*4;
|
||||||
|
@ -85,7 +85,7 @@ int ZeroGS::Save(s8* pbydata)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZeroGS::Load(s8* pbydata)
|
bool ZZLoad(s8* pbydata)
|
||||||
{
|
{
|
||||||
memset(s_uTex1Data, 0, sizeof(s_uTex1Data));
|
memset(s_uTex1Data, 0, sizeof(s_uTex1Data));
|
||||||
memset(s_uClampData, 0, sizeof(s_uClampData));
|
memset(s_uClampData, 0, sizeof(s_uClampData));
|
||||||
|
@ -99,7 +99,7 @@ bool ZeroGS::Load(s8* pbydata)
|
||||||
{
|
{
|
||||||
g_MemTargs.Destroy();
|
g_MemTargs.Destroy();
|
||||||
|
|
||||||
GSStateReset();
|
ZZGSStateReset();
|
||||||
pbydata += 32;
|
pbydata += 32;
|
||||||
|
|
||||||
//int context = *(int*)pbydata;
|
//int context = *(int*)pbydata;
|
||||||
|
|
|
@ -33,8 +33,6 @@ extern HINSTANCE hInst;
|
||||||
|
|
||||||
// ----------------- Defines
|
// ----------------- Defines
|
||||||
|
|
||||||
using namespace ZeroGS;
|
|
||||||
|
|
||||||
#define TEXWRAP_REPEAT 0
|
#define TEXWRAP_REPEAT 0
|
||||||
#define TEXWRAP_CLAMP 1
|
#define TEXWRAP_CLAMP 1
|
||||||
#define TEXWRAP_REGION_REPEAT 2
|
#define TEXWRAP_REGION_REPEAT 2
|
||||||
|
@ -87,7 +85,6 @@ char* EFFECT_DIR;
|
||||||
|
|
||||||
bool g_bCRTCBilinear = true;
|
bool g_bCRTCBilinear = true;
|
||||||
|
|
||||||
namespace ZeroGS {
|
|
||||||
float4 g_vdepth, vlogz;
|
float4 g_vdepth, vlogz;
|
||||||
FRAGMENTSHADER ppsBitBlt[2], ppsBitBltDepth, ppsOne;
|
FRAGMENTSHADER ppsBitBlt[2], ppsBitBltDepth, ppsOne;
|
||||||
FRAGMENTSHADER ppsBaseTexture, ppsConvert16to32, ppsConvert32to16;
|
FRAGMENTSHADER ppsBaseTexture, ppsConvert16to32, ppsConvert32to16;
|
||||||
|
@ -96,7 +93,6 @@ namespace ZeroGS {
|
||||||
VERTEXSHADER pvsBitBlt;
|
VERTEXSHADER pvsBitBlt;
|
||||||
|
|
||||||
inline bool LoadEffects();
|
inline bool LoadEffects();
|
||||||
}
|
|
||||||
|
|
||||||
struct SHADERHEADER
|
struct SHADERHEADER
|
||||||
{
|
{
|
||||||
|
@ -506,7 +502,7 @@ void SetupVertexProgramParameters(ZZshProgram prog, int context)
|
||||||
SetupFragmentProgramParameters(&fragment, !!(Index&SH_CONTEXT1), 0); \
|
SetupFragmentProgramParameters(&fragment, !!(Index&SH_CONTEXT1), 0); \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
inline bool ZeroGS::LoadEffects()
|
inline bool LoadEffects()
|
||||||
{
|
{
|
||||||
assert( s_lpShaderResources != NULL );
|
assert( s_lpShaderResources != NULL );
|
||||||
|
|
||||||
|
@ -711,7 +707,7 @@ FRAGMENTSHADER* ZZshLoadShadeEffect(int type, int texfilter, int fog, int testae
|
||||||
SET_PSFILENAME(fragment, name); \
|
SET_PSFILENAME(fragment, name); \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
inline bool ZeroGS::LoadEffects()
|
inline bool LoadEffects()
|
||||||
{
|
{
|
||||||
// clear the textures
|
// clear the textures
|
||||||
for(int i = 0; i < ARRAY_SIZE(ppsTexture); ++i) {
|
for(int i = 0; i < ARRAY_SIZE(ppsTexture); ++i) {
|
||||||
|
|
|
@ -174,7 +174,6 @@ struct VERTEXSHADER
|
||||||
int ParametersStart, ParametersFinish;
|
int ParametersStart, ParametersFinish;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace ZeroGS {
|
|
||||||
extern float4 g_vdepth;
|
extern float4 g_vdepth;
|
||||||
extern float4 vlogz;
|
extern float4 vlogz;
|
||||||
extern VERTEXSHADER pvsBitBlt;
|
extern VERTEXSHADER pvsBitBlt;
|
||||||
|
@ -183,7 +182,6 @@ namespace ZeroGS {
|
||||||
|
|
||||||
extern FRAGMENTSHADER ppsRegular[4], ppsTexture[NUM_SHADERS];
|
extern FRAGMENTSHADER ppsRegular[4], ppsTexture[NUM_SHADERS];
|
||||||
extern FRAGMENTSHADER ppsCRTC[2], ppsCRTC24[2], ppsCRTCTarg[2];
|
extern FRAGMENTSHADER ppsCRTC[2], ppsCRTC24[2], ppsCRTCTarg[2];
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------- Functions -------------------------------
|
// ------------------------- Functions -------------------------------
|
||||||
|
|
||||||
|
@ -225,8 +223,7 @@ extern bool ZZshLoadExtraEffects();
|
||||||
|
|
||||||
extern FRAGMENTSHADER* ZZshLoadShadeEffect(int type, int texfilter, int fog, int testaem, int exactcolor, const clampInfo& clamp, int context, bool* pbFailed);
|
extern FRAGMENTSHADER* ZZshLoadShadeEffect(int type, int texfilter, int fog, int testaem, int exactcolor, const clampInfo& clamp, int context, bool* pbFailed);
|
||||||
|
|
||||||
namespace ZeroGS {
|
|
||||||
// only sets a limited amount of state (for Update)
|
// only sets a limited amount of state (for Update)
|
||||||
void SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0, bool CheckVB, FRAGMENTSHADER* pfragment, int force);
|
void SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0, bool CheckVB, FRAGMENTSHADER* pfragment, int force);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -65,14 +65,14 @@ string strSnapshot;
|
||||||
//------------------ Code
|
//------------------ Code
|
||||||
|
|
||||||
// Set variables need to made a snapshoot when it's possible
|
// Set variables need to made a snapshoot when it's possible
|
||||||
void ZeroGS::SaveSnapshot(const char* filename)
|
void SaveSnapshot(const char* filename)
|
||||||
{
|
{
|
||||||
g_bMakeSnapshot = true;
|
g_bMakeSnapshot = true;
|
||||||
strSnapshot = filename;
|
strSnapshot = filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save curent renderer in jpeg or TGA format
|
// Save curent renderer in jpeg or TGA format
|
||||||
bool ZeroGS::SaveRenderTarget(const char* filename, int width, int height, int jpeg)
|
bool SaveRenderTarget(const char* filename, int width, int height, int jpeg)
|
||||||
{
|
{
|
||||||
bool bflip = height < 0;
|
bool bflip = height < 0;
|
||||||
height = abs(height);
|
height = abs(height);
|
||||||
|
@ -100,7 +100,7 @@ bool ZeroGS::SaveRenderTarget(const char* filename, int width, int height, int j
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save selected texture as TGA
|
// Save selected texture as TGA
|
||||||
bool ZeroGS::SaveTexture(const char* filename, u32 textarget, u32 tex, int width, int height)
|
bool SaveTexture(const char* filename, u32 textarget, u32 tex, int width, int height)
|
||||||
{
|
{
|
||||||
vector<u32> data(width*height);
|
vector<u32> data(width*height);
|
||||||
glBindTexture(textarget, tex);
|
glBindTexture(textarget, tex);
|
||||||
|
@ -112,7 +112,7 @@ bool ZeroGS::SaveTexture(const char* filename, u32 textarget, u32 tex, int width
|
||||||
}
|
}
|
||||||
|
|
||||||
// save image as JPEG
|
// save image as JPEG
|
||||||
bool ZeroGS::SaveJPEG(const char* filename, int image_width, int image_height, const void* pdata, int quality)
|
bool SaveJPEG(const char* filename, int image_width, int image_height, const void* pdata, int quality)
|
||||||
{
|
{
|
||||||
u8* image_buffer = new u8[image_width * image_height * 3];
|
u8* image_buffer = new u8[image_width * image_height * 3];
|
||||||
u8* psrc = (u8*)pdata;
|
u8* psrc = (u8*)pdata;
|
||||||
|
@ -286,7 +286,7 @@ __attribute__((packed));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Save image as TGA
|
// Save image as TGA
|
||||||
bool ZeroGS::SaveTGA(const char* filename, int width, int height, void* pdata)
|
bool SaveTGA(const char* filename, int width, int height, void* pdata)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
TGA_HEADER hdr;
|
TGA_HEADER hdr;
|
||||||
|
@ -314,7 +314,7 @@ bool ZeroGS::SaveTGA(const char* filename, int width, int height, void* pdata)
|
||||||
|
|
||||||
// AVI capture stuff
|
// AVI capture stuff
|
||||||
// AVI start -- set needed global variables
|
// AVI start -- set needed global variables
|
||||||
void ZeroGS::StartCapture()
|
void StartCapture()
|
||||||
{
|
{
|
||||||
if (conf.captureAvi()) return;
|
if (conf.captureAvi()) return;
|
||||||
if (!s_aviinit)
|
if (!s_aviinit)
|
||||||
|
@ -338,7 +338,7 @@ void ZeroGS::StartCapture()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop.
|
// Stop.
|
||||||
void ZeroGS::StopCapture()
|
void StopCapture()
|
||||||
{
|
{
|
||||||
if (!conf.captureAvi()) return;
|
if (!conf.captureAvi()) return;
|
||||||
s_avicapturing = 0;
|
s_avicapturing = 0;
|
||||||
|
@ -347,7 +347,7 @@ void ZeroGS::StopCapture()
|
||||||
}
|
}
|
||||||
|
|
||||||
// And capture frame does not work on linux.
|
// And capture frame does not work on linux.
|
||||||
void ZeroGS::CaptureFrame()
|
void CaptureFrame()
|
||||||
{
|
{
|
||||||
if ((!s_avicapturing) || (!s_aviinit)) return;
|
if ((!s_avicapturing) || (!s_aviinit)) return;
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ void ZeroGS::CaptureFrame()
|
||||||
{
|
{
|
||||||
s_avicapturing = 0;
|
s_avicapturing = 0;
|
||||||
STOP_AVI();
|
STOP_AVI();
|
||||||
ZeroGS::AddMessage("Failed to create avi");
|
ZZAddMessage("Failed to create avi");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ void ZeroGS::CaptureFrame()
|
||||||
|
|
||||||
// It's nearly the same as save texture
|
// It's nearly the same as save texture
|
||||||
void
|
void
|
||||||
ZeroGS::SaveTex(tex0Info* ptex, int usevid)
|
SaveTex(tex0Info* ptex, int usevid)
|
||||||
{
|
{
|
||||||
vector<u32> data(ptex->tw*ptex->th);
|
vector<u32> data(ptex->tw*ptex->th);
|
||||||
vector<u8> srcdata;
|
vector<u8> srcdata;
|
||||||
|
@ -617,7 +617,7 @@ ZeroGS::SaveTex(tex0Info* ptex, int usevid)
|
||||||
|
|
||||||
// Do the save texture and return file name of it
|
// Do the save texture and return file name of it
|
||||||
// Do not forget to call free(), other wise there would be memory leak!
|
// Do not forget to call free(), other wise there would be memory leak!
|
||||||
char* ZeroGS::NamedSaveTex(tex0Info* ptex, int usevid)
|
char* NamedSaveTex(tex0Info* ptex, int usevid)
|
||||||
{
|
{
|
||||||
SaveTex(ptex, usevid);
|
SaveTex(ptex, usevid);
|
||||||
char* Name = (char*)malloc(TGA_FILE_NAME_MAX_LENGTH);
|
char* Name = (char*)malloc(TGA_FILE_NAME_MAX_LENGTH);
|
||||||
|
@ -631,7 +631,7 @@ char* ZeroGS::NamedSaveTex(tex0Info* ptex, int usevid)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special function, which is safe to call from any other file, without aviutils problems.
|
// Special function, which is safe to call from any other file, without aviutils problems.
|
||||||
void ZeroGS::Stop_Avi()
|
void Stop_Avi()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
STOP_AVI();
|
STOP_AVI();
|
||||||
|
@ -640,7 +640,7 @@ void ZeroGS::Stop_Avi()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::Delete_Avi_Capture()
|
void Delete_Avi_Capture()
|
||||||
{
|
{
|
||||||
if (s_aviinit)
|
if (s_aviinit)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#include "GS.h"
|
#include "GS.h"
|
||||||
#include "Mem.h"
|
#include "Mem.h"
|
||||||
|
|
||||||
using namespace ZeroGS;
|
|
||||||
// ----------------- Defines
|
// ----------------- Defines
|
||||||
#define MINMAX_SHIFT 3
|
#define MINMAX_SHIFT 3
|
||||||
|
|
||||||
|
@ -37,20 +36,20 @@ int maxmin = 608;
|
||||||
// ----------------- Code
|
// ----------------- Code
|
||||||
|
|
||||||
// Constructor. Set width and height to 1
|
// Constructor. Set width and height to 1
|
||||||
ZeroGS::VB::VB()
|
VB::VB()
|
||||||
{
|
{
|
||||||
memset(this, 0, sizeof(ZeroGS::VB));
|
memset(this, 0, sizeof(VB));
|
||||||
tex0.tw = 1;
|
tex0.tw = 1;
|
||||||
tex0.th = 1;
|
tex0.th = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
ZeroGS::VB::~VB()
|
VB::~VB()
|
||||||
{
|
{
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::VB::Destroy()
|
void VB::Destroy()
|
||||||
{
|
{
|
||||||
_aligned_free(pBufferData);
|
_aligned_free(pBufferData);
|
||||||
pBufferData = NULL;
|
pBufferData = NULL;
|
||||||
|
@ -65,7 +64,7 @@ int ConstraintReason;
|
||||||
// Return number of 64-pixels block, that guaranted could be hold in memory
|
// Return number of 64-pixels block, that guaranted could be hold in memory
|
||||||
// from gsfb.fbp and tbp (textrure pase), zbuf.zbp (Z-buffer), frame.fbp
|
// from gsfb.fbp and tbp (textrure pase), zbuf.zbp (Z-buffer), frame.fbp
|
||||||
// (previous frame).
|
// (previous frame).
|
||||||
inline int ZeroGS::VB::FindMinimalMemoryConstrain(int tbp, int maxpos)
|
inline int VB::FindMinimalMemoryConstrain(int tbp, int maxpos)
|
||||||
{
|
{
|
||||||
int MinConstraint = maxpos;
|
int MinConstraint = maxpos;
|
||||||
|
|
||||||
|
@ -116,7 +115,7 @@ inline int ZeroGS::VB::FindMinimalMemoryConstrain(int tbp, int maxpos)
|
||||||
|
|
||||||
// Return number of 64 pizel words that could be placed in Z-Buffer
|
// Return number of 64 pizel words that could be placed in Z-Buffer
|
||||||
// If no Z-buffer present return old constraint
|
// If no Z-buffer present return old constraint
|
||||||
inline int ZeroGS::VB::FindZbufferMemoryConstrain(int tbp, int maxpos)
|
inline int VB::FindZbufferMemoryConstrain(int tbp, int maxpos)
|
||||||
{
|
{
|
||||||
int MinConstraint = maxpos;
|
int MinConstraint = maxpos;
|
||||||
|
|
||||||
|
@ -147,7 +146,7 @@ inline int GetScissorY(int y)
|
||||||
|
|
||||||
//There is several reasons to limit a height of frame: maximum buffer size, calculated size
|
//There is several reasons to limit a height of frame: maximum buffer size, calculated size
|
||||||
//from fbw and fbh and scissoring.
|
//from fbw and fbh and scissoring.
|
||||||
inline int ZeroGS::VB::FindMinimalHeightConstrain(int maxpos)
|
inline int VB::FindMinimalHeightConstrain(int maxpos)
|
||||||
{
|
{
|
||||||
int MinConstraint = maxpos;
|
int MinConstraint = maxpos;
|
||||||
|
|
||||||
|
@ -176,7 +175,7 @@ inline int ZeroGS::VB::FindMinimalHeightConstrain(int maxpos)
|
||||||
|
|
||||||
// 32 bit frames have additional constraints to frame
|
// 32 bit frames have additional constraints to frame
|
||||||
// maxpos was maximum length of frame at normal constraints
|
// maxpos was maximum length of frame at normal constraints
|
||||||
inline void ZeroGS::VB::CheckFrame32bitRes(int maxpos)
|
inline void VB::CheckFrame32bitRes(int maxpos)
|
||||||
{
|
{
|
||||||
int fbh = frame.fbh;
|
int fbh = frame.fbh;
|
||||||
|
|
||||||
|
@ -215,7 +214,7 @@ inline void ZeroGS::VB::CheckFrame32bitRes(int maxpos)
|
||||||
// 4Mb memory in 64 bit (4 bytes) words.
|
// 4Mb memory in 64 bit (4 bytes) words.
|
||||||
// |------------------------|---------------------|----------|----------|---------------------|
|
// |------------------------|---------------------|----------|----------|---------------------|
|
||||||
// 0 gsfb.fbp zbuff.zpb tbp frame.fbp 2^20/64
|
// 0 gsfb.fbp zbuff.zpb tbp frame.fbp 2^20/64
|
||||||
inline int ZeroGS::VB::CheckFrameAddConstraints(int tbp)
|
inline int VB::CheckFrameAddConstraints(int tbp)
|
||||||
{
|
{
|
||||||
if (gsfb.fbw <= 0)
|
if (gsfb.fbw <= 0)
|
||||||
{
|
{
|
||||||
|
@ -263,7 +262,7 @@ inline int ZeroGS::VB::CheckFrameAddConstraints(int tbp)
|
||||||
|
|
||||||
// Check if after resizing new depth target is needed to be used.
|
// Check if after resizing new depth target is needed to be used.
|
||||||
// it returns 2 if a new depth target is used.
|
// it returns 2 if a new depth target is used.
|
||||||
inline int ZeroGS::VB::CheckFrameResolveDepth(int tbp)
|
inline int VB::CheckFrameResolveDepth(int tbp)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
CDepthTarget* pprevdepth = pdepth;
|
CDepthTarget* pprevdepth = pdepth;
|
||||||
|
@ -289,7 +288,7 @@ inline int ZeroGS::VB::CheckFrameResolveDepth(int tbp)
|
||||||
|
|
||||||
// Check if after resizing, a new render target is needed to be used. Also perform deptarget check.
|
// Check if after resizing, a new render target is needed to be used. Also perform deptarget check.
|
||||||
// Returns 1 if only 1 render target is changed and 3 -- if both.
|
// Returns 1 if only 1 render target is changed and 3 -- if both.
|
||||||
inline int ZeroGS::VB::CheckFrameResolveRender(int tbp)
|
inline int VB::CheckFrameResolveRender(int tbp)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
|
@ -335,7 +334,7 @@ inline int ZeroGS::VB::CheckFrameResolveRender(int tbp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// After frame resetting, it is possible that 16 to 32 or 32 to 16 (color bits) conversion should be made.
|
// After frame resetting, it is possible that 16 to 32 or 32 to 16 (color bits) conversion should be made.
|
||||||
inline void ZeroGS::VB::CheckFrame16vs32Conversion()
|
inline void VB::CheckFrame16vs32Conversion()
|
||||||
{
|
{
|
||||||
if (prndr->status & CRenderTarget::TS_NeedConvert32)
|
if (prndr->status & CRenderTarget::TS_NeedConvert32)
|
||||||
{
|
{
|
||||||
|
@ -357,7 +356,7 @@ inline void ZeroGS::VB::CheckFrame16vs32Conversion()
|
||||||
|
|
||||||
// A lot of times, the target is too big and overwrites the texture.
|
// A lot of times, the target is too big and overwrites the texture.
|
||||||
// If tbp != 0, use it to bound.
|
// If tbp != 0, use it to bound.
|
||||||
void ZeroGS::VB::CheckFrame(int tbp)
|
void VB::CheckFrame(int tbp)
|
||||||
{
|
{
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
|
|
||||||
|
@ -407,11 +406,11 @@ void ZeroGS::VB::CheckFrame(int tbp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is the case, most easy to perform, when nothing was changed
|
// This is the case, most easy to perform, when nothing was changed
|
||||||
inline void ZeroGS::VB::FlushTexUnchangedClutDontUpdate()
|
inline void VB::FlushTexUnchangedClutDontUpdate()
|
||||||
{
|
{
|
||||||
if (ZZOglGet_cld_TexBits(uNextTex0Data[1]))
|
if (ZZOglGet_cld_TexBits(uNextTex0Data[1]))
|
||||||
{
|
{
|
||||||
ZeroGS::texClutWrite(ictx);
|
texClutWrite(ictx);
|
||||||
// invalidate to make sure target didn't change!
|
// invalidate to make sure target didn't change!
|
||||||
bVarsTexSync = false;
|
bVarsTexSync = false;
|
||||||
}
|
}
|
||||||
|
@ -419,9 +418,9 @@ inline void ZeroGS::VB::FlushTexUnchangedClutDontUpdate()
|
||||||
|
|
||||||
// The second of easy branch. We does not change storage model, so we don't need to
|
// The second of easy branch. We does not change storage model, so we don't need to
|
||||||
// update anything except texture itself
|
// update anything except texture itself
|
||||||
inline void ZeroGS::VB::FlushTexClutDontUpdate()
|
inline void VB::FlushTexClutDontUpdate()
|
||||||
{
|
{
|
||||||
if (!ZZOglClutStorageUnchanged(uCurTex0Data, uNextTex0Data)) ZeroGS::Flush(ictx);
|
if (!ZZOglClutStorageUnchanged(uCurTex0Data, uNextTex0Data)) Flush(ictx);
|
||||||
|
|
||||||
// clut memory isn't going to be loaded so can ignore, but at least update CSA and CPSM!
|
// clut memory isn't going to be loaded so can ignore, but at least update CSA and CPSM!
|
||||||
uCurTex0Data[1] = (uCurTex0Data[1] & CPSM_CSA_NOTMASK) | (uNextTex0Data[1] & CPSM_CSA_BITMASK);
|
uCurTex0Data[1] = (uCurTex0Data[1] & CPSM_CSA_NOTMASK) | (uNextTex0Data[1] & CPSM_CSA_BITMASK);
|
||||||
|
@ -429,14 +428,14 @@ inline void ZeroGS::VB::FlushTexClutDontUpdate()
|
||||||
tex0.csa = ZZOglGet_csa_TexBits(uNextTex0Data[1]);
|
tex0.csa = ZZOglGet_csa_TexBits(uNextTex0Data[1]);
|
||||||
tex0.cpsm = ZZOglGet_cpsm_TexBits(uNextTex0Data[1]);
|
tex0.cpsm = ZZOglGet_cpsm_TexBits(uNextTex0Data[1]);
|
||||||
|
|
||||||
ZeroGS::texClutWrite(ictx);
|
texClutWrite(ictx);
|
||||||
|
|
||||||
bVarsTexSync = false;
|
bVarsTexSync = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set texture variables after big change
|
// Set texture variables after big change
|
||||||
inline void ZeroGS::VB::FlushTexSetNewVars(u32 psm)
|
inline void VB::FlushTexSetNewVars(u32 psm)
|
||||||
{
|
{
|
||||||
tex0.tbp0 = ZZOglGet_tbp0_TexBits(uNextTex0Data[0]);
|
tex0.tbp0 = ZZOglGet_tbp0_TexBits(uNextTex0Data[0]);
|
||||||
tex0.tbw = ZZOglGet_tbw_TexBitsMult(uNextTex0Data[0]);
|
tex0.tbw = ZZOglGet_tbw_TexBitsMult(uNextTex0Data[0]);
|
||||||
|
@ -447,13 +446,13 @@ inline void ZeroGS::VB::FlushTexSetNewVars(u32 psm)
|
||||||
tex0.tcc = ZZOglGet_tcc_TexBits(uNextTex0Data[1]);
|
tex0.tcc = ZZOglGet_tcc_TexBits(uNextTex0Data[1]);
|
||||||
tex0.tfx = ZZOglGet_tfx_TexBits(uNextTex0Data[1]);
|
tex0.tfx = ZZOglGet_tfx_TexBits(uNextTex0Data[1]);
|
||||||
|
|
||||||
ZeroGS::fiTexWidth[ictx] = (1 / 16.0f) / tex0.tw;
|
fiTexWidth[ictx] = (1 / 16.0f) / tex0.tw;
|
||||||
ZeroGS::fiTexHeight[ictx] = (1 / 16.0f) / tex0.th;
|
fiTexHeight[ictx] = (1 / 16.0f) / tex0.th;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush == draw on screen
|
// Flush == draw on screen
|
||||||
// This function made VB state consistant before real Flush.
|
// This function made VB state consistant before real Flush.
|
||||||
void ZeroGS::VB::FlushTexData()
|
void VB::FlushTexData()
|
||||||
{
|
{
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
|
|
||||||
|
@ -487,7 +486,7 @@ void ZeroGS::VB::FlushTexData()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Made the full update
|
// Made the full update
|
||||||
ZeroGS::Flush(ictx);
|
Flush(ictx);
|
||||||
|
|
||||||
bVarsTexSync = false;
|
bVarsTexSync = false;
|
||||||
bTexConstsSync = false;
|
bTexConstsSync = false;
|
||||||
|
@ -497,7 +496,7 @@ void ZeroGS::VB::FlushTexData()
|
||||||
|
|
||||||
FlushTexSetNewVars(psm);
|
FlushTexSetNewVars(psm);
|
||||||
|
|
||||||
if (PSMT_ISCLUT(psm)) ZeroGS::CluttingForFlushedTex(&tex0, uNextTex0Data[1], ictx) ;
|
if (PSMT_ISCLUT(psm)) CluttingForFlushedTex(&tex0, uNextTex0Data[1], ictx) ;
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#define RHA
|
#define RHA
|
||||||
//#define RW
|
//#define RW
|
||||||
|
|
||||||
using namespace ZeroGS;
|
|
||||||
extern int g_TransferredToGPU;
|
extern int g_TransferredToGPU;
|
||||||
extern bool g_bUpdateStencil;
|
extern bool g_bUpdateStencil;
|
||||||
|
|
||||||
|
@ -47,12 +46,9 @@ extern int s_nResolved;
|
||||||
extern u32 g_nResolve;
|
extern u32 g_nResolve;
|
||||||
extern bool g_bSaveTrans;
|
extern bool g_bSaveTrans;
|
||||||
|
|
||||||
namespace ZeroGS
|
|
||||||
{
|
|
||||||
CRenderTargetMngr s_RTs, s_DepthRTs;
|
CRenderTargetMngr s_RTs, s_DepthRTs;
|
||||||
CBitwiseTextureMngr s_BitwiseTextures;
|
CBitwiseTextureMngr s_BitwiseTextures;
|
||||||
CMemoryTargetMngr g_MemTargs;
|
CMemoryTargetMngr g_MemTargs;
|
||||||
}
|
|
||||||
|
|
||||||
//extern u32 s_ptexCurSet[2];
|
//extern u32 s_ptexCurSet[2];
|
||||||
bool g_bSaveZUpdate = 0;
|
bool g_bSaveZUpdate = 0;
|
||||||
|
@ -91,7 +87,7 @@ inline void DestroyAllTargetsHelper(void* ptr)
|
||||||
// returns false if creating texture was unsuccessful
|
// returns false if creating texture was unsuccessful
|
||||||
// fbh and fdb should be properly shifted before calling this!
|
// fbh and fdb should be properly shifted before calling this!
|
||||||
// We should ignore framebuffer trouble here, as we put textures of different sizes to it.
|
// We should ignore framebuffer trouble here, as we put textures of different sizes to it.
|
||||||
inline bool ZeroGS::CRenderTarget::InitialiseDefaultTexture(u32 *ptr_p, int fbw, int fbh)
|
inline bool CRenderTarget::InitialiseDefaultTexture(u32 *ptr_p, int fbw, int fbh)
|
||||||
{
|
{
|
||||||
glGenTextures(1, ptr_p);
|
glGenTextures(1, ptr_p);
|
||||||
glBindTexture(GL_TEXTURE_RECTANGLE_NV, *ptr_p);
|
glBindTexture(GL_TEXTURE_RECTANGLE_NV, *ptr_p);
|
||||||
|
@ -109,7 +105,7 @@ inline bool ZeroGS::CRenderTarget::InitialiseDefaultTexture(u32 *ptr_p, int fbw,
|
||||||
// Draw 4 triangles from binded array using only stencil buffer
|
// Draw 4 triangles from binded array using only stencil buffer
|
||||||
inline void FillOnlyStencilBuffer()
|
inline void FillOnlyStencilBuffer()
|
||||||
{
|
{
|
||||||
if (ZeroGS::IsWriteDestAlphaTest() && !(conf.settings().no_stencil))
|
if (IsWriteDestAlphaTest() && !(conf.settings().no_stencil))
|
||||||
{
|
{
|
||||||
glColorMask(0, 0, 0, 0);
|
glColorMask(0, 0, 0, 0);
|
||||||
glEnable(GL_ALPHA_TEST);
|
glEnable(GL_ALPHA_TEST);
|
||||||
|
@ -125,7 +121,7 @@ inline void FillOnlyStencilBuffer()
|
||||||
|
|
||||||
// used for transformation from vertex position in GS window.coords (I hope)
|
// used for transformation from vertex position in GS window.coords (I hope)
|
||||||
// to view coordinates (in range 0, 1).
|
// to view coordinates (in range 0, 1).
|
||||||
inline float4 ZeroGS::CRenderTarget::DefaultBitBltPos()
|
inline float4 CRenderTarget::DefaultBitBltPos()
|
||||||
{
|
{
|
||||||
float4 v = float4(1, -1, 0.5f / (float)RW(fbw), 0.5f / (float)RH(fbh));
|
float4 v = float4(1, -1, 0.5f / (float)RW(fbw), 0.5f / (float)RH(fbh));
|
||||||
v *= 1.0f / 32767.0f;
|
v *= 1.0f / 32767.0f;
|
||||||
|
@ -135,7 +131,7 @@ inline float4 ZeroGS::CRenderTarget::DefaultBitBltPos()
|
||||||
|
|
||||||
// Used to transform texture coordinates from GS (when 0,0 is upper left) to
|
// Used to transform texture coordinates from GS (when 0,0 is upper left) to
|
||||||
// OpenGL (0,0 - lower left).
|
// OpenGL (0,0 - lower left).
|
||||||
inline float4 ZeroGS::CRenderTarget::DefaultBitBltTex()
|
inline float4 CRenderTarget::DefaultBitBltTex()
|
||||||
{
|
{
|
||||||
// I really sure that -0.5 is correct, because OpenGL have no half-offset
|
// I really sure that -0.5 is correct, because OpenGL have no half-offset
|
||||||
// issue, DirectX known for.
|
// issue, DirectX known for.
|
||||||
|
@ -153,19 +149,19 @@ inline void BindToSample(u32 *p_ptr)
|
||||||
////////////////////
|
////////////////////
|
||||||
// Render Targets //
|
// Render Targets //
|
||||||
////////////////////
|
////////////////////
|
||||||
ZeroGS::CRenderTarget::CRenderTarget() : ptex(0), ptexFeedback(0), psys(NULL)
|
CRenderTarget::CRenderTarget() : ptex(0), ptexFeedback(0), psys(NULL)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
nUpdateTarg = 0;
|
nUpdateTarg = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroGS::CRenderTarget::~CRenderTarget()
|
CRenderTarget::~CRenderTarget()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZeroGS::CRenderTarget::Create(const frameInfo& frame)
|
bool CRenderTarget::Create(const frameInfo& frame)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
Resolve();
|
Resolve();
|
||||||
|
@ -208,7 +204,7 @@ bool ZeroGS::CRenderTarget::Create(const frameInfo& frame)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CRenderTarget::Destroy()
|
void CRenderTarget::Destroy()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
created = 1;
|
created = 1;
|
||||||
|
@ -218,7 +214,7 @@ void ZeroGS::CRenderTarget::Destroy()
|
||||||
SAFE_RELEASE_TEX(ptexFeedback);
|
SAFE_RELEASE_TEX(ptexFeedback);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CRenderTarget::SetTarget(int fbplocal, const Rect2& scissor, int context)
|
void CRenderTarget::SetTarget(int fbplocal, const Rect2& scissor, int context)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
int dy = 0;
|
int dy = 0;
|
||||||
|
@ -261,7 +257,7 @@ void ZeroGS::CRenderTarget::SetTarget(int fbplocal, const Rect2& scissor, int co
|
||||||
scissorrect.h = RH(scissorrect.h);
|
scissorrect.h = RH(scissorrect.h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CRenderTarget::SetViewport()
|
void CRenderTarget::SetViewport()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
glViewport(0, 0, RW(fbw), RH(fbh));
|
glViewport(0, 0, RW(fbw), RH(fbh));
|
||||||
|
@ -272,7 +268,7 @@ inline bool NotResolveHelper()
|
||||||
return ((s_nResolved > 8 && (2 * s_nResolved > fFPS - 10)) || (conf.settings().no_target_resolve));
|
return ((s_nResolved > 8 && (2 * s_nResolved > fFPS - 10)) || (conf.settings().no_target_resolve));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CRenderTarget::Resolve()
|
void CRenderTarget::Resolve()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -281,7 +277,7 @@ void ZeroGS::CRenderTarget::Resolve()
|
||||||
// flush if necessary
|
// flush if necessary
|
||||||
FlushIfNecesary(this) ;
|
FlushIfNecesary(this) ;
|
||||||
|
|
||||||
if ((IsDepth() && !ZeroGS::IsWriteDepth()) || NotResolveHelper())
|
if ((IsDepth() && !IsWriteDepth()) || NotResolveHelper())
|
||||||
{
|
{
|
||||||
// don't resolve if depths aren't used
|
// don't resolve if depths aren't used
|
||||||
status = TS_Resolved;
|
status = TS_Resolved;
|
||||||
|
@ -314,7 +310,7 @@ void ZeroGS::CRenderTarget::Resolve()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CRenderTarget::Resolve(int startrange, int endrange)
|
void CRenderTarget::Resolve(int startrange, int endrange)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -387,7 +383,7 @@ void ZeroGS::CRenderTarget::Resolve(int startrange, int endrange)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth)
|
void CRenderTarget::Update(int context, CRenderTarget* pdepth)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -488,7 +484,7 @@ void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth)
|
||||||
|
|
||||||
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||||
|
|
||||||
if (ZeroGS::IsWriteDestAlphaTest())
|
if (IsWriteDestAlphaTest())
|
||||||
{
|
{
|
||||||
glEnable(GL_STENCIL_TEST);
|
glEnable(GL_STENCIL_TEST);
|
||||||
glStencilFunc(GL_ALWAYS, 0, 0xff);
|
glStencilFunc(GL_ALWAYS, 0, 0xff);
|
||||||
|
@ -510,17 +506,17 @@ void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth)
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
|
||||||
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||||
if (conf.mrtdepth && pdepth != NULL && ZeroGS::IsWriteDepth()) pdepth->SetRenderTarget(1);
|
if (conf.mrtdepth && pdepth != NULL && IsWriteDepth()) pdepth->SetRenderTarget(1);
|
||||||
|
|
||||||
status = TS_Resolved;
|
status = TS_Resolved;
|
||||||
|
|
||||||
// reset since settings changed
|
// reset since settings changed
|
||||||
vb[0].bVarsTexSync = 0;
|
vb[0].bVarsTexSync = 0;
|
||||||
|
|
||||||
ZeroGS::ResetAlphaVariables();
|
ResetAlphaVariables();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CRenderTarget::ConvertTo32()
|
void CRenderTarget::ConvertTo32()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -568,7 +564,7 @@ void ZeroGS::CRenderTarget::ConvertTo32()
|
||||||
|
|
||||||
// assume depth already set !?
|
// assume depth already set !?
|
||||||
FBTexture(0, ptexConv);
|
FBTexture(0, ptexConv);
|
||||||
ZeroGS::ResetRenderTarget(1);
|
ResetRenderTarget(1);
|
||||||
|
|
||||||
BindToSample(&ptex);
|
BindToSample(&ptex);
|
||||||
ZZshGLSetTextureParameter(ppsConvert16to32.prog, ppsConvert16to32.sFinal, ptex, "Convert 16 to 32.Final");
|
ZZshGLSetTextureParameter(ppsConvert16to32.prog, ppsConvert16to32.sFinal, ptex, "Convert 16 to 32.Final");
|
||||||
|
@ -613,7 +609,7 @@ void ZeroGS::CRenderTarget::ConvertTo32()
|
||||||
status = TS_Resolved;
|
status = TS_Resolved;
|
||||||
|
|
||||||
// TODO, reset depth?
|
// TODO, reset depth?
|
||||||
if (ZeroGS::icurctx >= 0)
|
if (icurctx >= 0)
|
||||||
{
|
{
|
||||||
// reset since settings changed
|
// reset since settings changed
|
||||||
vb[icurctx].bVarsTexSync = 0;
|
vb[icurctx].bVarsTexSync = 0;
|
||||||
|
@ -623,7 +619,7 @@ void ZeroGS::CRenderTarget::ConvertTo32()
|
||||||
vb[0].bVarsTexSync = 0;
|
vb[0].bVarsTexSync = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CRenderTarget::ConvertTo16()
|
void CRenderTarget::ConvertTo16()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -669,7 +665,7 @@ void ZeroGS::CRenderTarget::ConvertTo16()
|
||||||
|
|
||||||
// assume depth already set !?
|
// assume depth already set !?
|
||||||
FBTexture(0, ptexConv);
|
FBTexture(0, ptexConv);
|
||||||
ZeroGS::ResetRenderTarget(1);
|
ResetRenderTarget(1);
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
|
|
||||||
BindToSample(&ptex);
|
BindToSample(&ptex);
|
||||||
|
@ -719,7 +715,7 @@ void ZeroGS::CRenderTarget::ConvertTo16()
|
||||||
status = TS_Resolved;
|
status = TS_Resolved;
|
||||||
|
|
||||||
// TODO, reset depth?
|
// TODO, reset depth?
|
||||||
if (ZeroGS::icurctx >= 0)
|
if (icurctx >= 0)
|
||||||
{
|
{
|
||||||
// reset since settings changed
|
// reset since settings changed
|
||||||
vb[icurctx].bVarsTexSync = 0;
|
vb[icurctx].bVarsTexSync = 0;
|
||||||
|
@ -729,7 +725,7 @@ void ZeroGS::CRenderTarget::ConvertTo16()
|
||||||
vb[0].bVarsTexSync = 0;
|
vb[0].bVarsTexSync = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CRenderTarget::_CreateFeedback()
|
void CRenderTarget::_CreateFeedback()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -797,7 +793,7 @@ void ZeroGS::CRenderTarget::_CreateFeedback()
|
||||||
status |= TS_FeedbackReady;
|
status |= TS_FeedbackReady;
|
||||||
|
|
||||||
// TODO, reset depth?
|
// TODO, reset depth?
|
||||||
if (ZeroGS::icurctx >= 0)
|
if (icurctx >= 0)
|
||||||
{
|
{
|
||||||
// reset since settings changed
|
// reset since settings changed
|
||||||
vb[icurctx].bVarsTexSync = 0;
|
vb[icurctx].bVarsTexSync = 0;
|
||||||
|
@ -806,7 +802,7 @@ void ZeroGS::CRenderTarget::_CreateFeedback()
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CRenderTarget::SetRenderTarget(int targ)
|
void CRenderTarget::SetRenderTarget(int targ)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -817,16 +813,16 @@ void ZeroGS::CRenderTarget::SetRenderTarget(int targ)
|
||||||
//ERROR_LOG_SPAM("The Framebuffer is not complete. Glitches could appear onscreen.\n");
|
//ERROR_LOG_SPAM("The Framebuffer is not complete. Glitches could appear onscreen.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroGS::CDepthTarget::CDepthTarget() : CRenderTarget(), pdepth(0), pstencil(0), icount(0) {}
|
CDepthTarget::CDepthTarget() : CRenderTarget(), pdepth(0), pstencil(0), icount(0) {}
|
||||||
|
|
||||||
ZeroGS::CDepthTarget::~CDepthTarget()
|
CDepthTarget::~CDepthTarget()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZeroGS::CDepthTarget::Create(const frameInfo& frame)
|
bool CDepthTarget::Create(const frameInfo& frame)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -871,7 +867,7 @@ bool ZeroGS::CDepthTarget::Create(const frameInfo& frame)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CDepthTarget::Destroy()
|
void CDepthTarget::Destroy()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -903,11 +899,11 @@ void ZeroGS::CDepthTarget::Destroy()
|
||||||
|
|
||||||
extern int g_nDepthUsed; // > 0 if depth is used
|
extern int g_nDepthUsed; // > 0 if depth is used
|
||||||
|
|
||||||
void ZeroGS::CDepthTarget::Resolve()
|
void CDepthTarget::Resolve()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
if (g_nDepthUsed > 0 && conf.mrtdepth && !(status&TS_Virtual) && ZeroGS::IsWriteDepth() && !(conf.settings().no_depth_resolve))
|
if (g_nDepthUsed > 0 && conf.mrtdepth && !(status&TS_Virtual) && IsWriteDepth() && !(conf.settings().no_depth_resolve))
|
||||||
CRenderTarget::Resolve();
|
CRenderTarget::Resolve();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -919,15 +915,15 @@ void ZeroGS::CDepthTarget::Resolve()
|
||||||
|
|
||||||
if (!(status&TS_Virtual))
|
if (!(status&TS_Virtual))
|
||||||
{
|
{
|
||||||
ZeroGS::SetWriteDepth();
|
SetWriteDepth();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CDepthTarget::Resolve(int startrange, int endrange)
|
void CDepthTarget::Resolve(int startrange, int endrange)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
if (g_nDepthUsed > 0 && conf.mrtdepth && !(status&TS_Virtual) && ZeroGS::IsWriteDepth())
|
if (g_nDepthUsed > 0 && conf.mrtdepth && !(status&TS_Virtual) && IsWriteDepth())
|
||||||
{
|
{
|
||||||
CRenderTarget::Resolve(startrange, endrange);
|
CRenderTarget::Resolve(startrange, endrange);
|
||||||
}
|
}
|
||||||
|
@ -942,11 +938,11 @@ void ZeroGS::CDepthTarget::Resolve(int startrange, int endrange)
|
||||||
|
|
||||||
if (!(status&TS_Virtual))
|
if (!(status&TS_Virtual))
|
||||||
{
|
{
|
||||||
ZeroGS::SetWriteDepth();
|
SetWriteDepth();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CDepthTarget::Update(int context, ZeroGS::CRenderTarget* prndr)
|
void CDepthTarget::Update(int context, CRenderTarget* prndr)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -963,7 +959,7 @@ void ZeroGS::CDepthTarget::Update(int context, ZeroGS::CRenderTarget* prndr)
|
||||||
|
|
||||||
DisableAllgl();
|
DisableAllgl();
|
||||||
|
|
||||||
ZeroGS::VB& curvb = vb[context];
|
VB& curvb = vb[context];
|
||||||
|
|
||||||
if (curvb.test.zte == 0) return;
|
if (curvb.test.zte == 0) return;
|
||||||
|
|
||||||
|
@ -1036,7 +1032,7 @@ void ZeroGS::CDepthTarget::Update(int context, ZeroGS::CRenderTarget* prndr)
|
||||||
|
|
||||||
status = TS_Resolved;
|
status = TS_Resolved;
|
||||||
|
|
||||||
if (!ZeroGS::IsWriteDepth())
|
if (!IsWriteDepth())
|
||||||
{
|
{
|
||||||
ResetRenderTarget(1);
|
ResetRenderTarget(1);
|
||||||
}
|
}
|
||||||
|
@ -1054,7 +1050,7 @@ void ZeroGS::CDepthTarget::Update(int context, ZeroGS::CRenderTarget* prndr)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CDepthTarget::SetDepthStencilSurface()
|
void CDepthTarget::SetDepthStencilSurface()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
TextureRect(GL_DEPTH_ATTACHMENT_EXT, pdepth);
|
TextureRect(GL_DEPTH_ATTACHMENT_EXT, pdepth);
|
||||||
|
@ -1085,7 +1081,7 @@ void ZeroGS::CDepthTarget::SetDepthStencilSurface()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CRenderTargetMngr::Destroy()
|
void CRenderTargetMngr::Destroy()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -1104,7 +1100,7 @@ void ZeroGS::CRenderTargetMngr::Destroy()
|
||||||
mapDummyTargs.clear();
|
mapDummyTargs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CRenderTargetMngr::DestroyAllTargs(int start, int end, int fbw)
|
void CRenderTargetMngr::DestroyAllTargs(int start, int end, int fbw)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -1166,14 +1162,14 @@ void ZeroGS::CRenderTargetMngr::DestroyAllTargs(int start, int end, int fbw)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CRenderTargetMngr::DestroyTarg(CRenderTarget* ptarg)
|
void CRenderTargetMngr::DestroyTarg(CRenderTarget* ptarg)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
DestroyAllTargetsHelper(ptarg) ;
|
DestroyAllTargetsHelper(ptarg) ;
|
||||||
delete ptarg;
|
delete ptarg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CRenderTargetMngr::DestroyIntersecting(CRenderTarget* prndr)
|
void CRenderTargetMngr::DestroyIntersecting(CRenderTarget* prndr)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
assert(prndr != NULL);
|
assert(prndr != NULL);
|
||||||
|
@ -1221,7 +1217,7 @@ inline bool CheckWidthIsSame(const frameInfo& frame, CRenderTarget* ptarg)
|
||||||
return (2 * frame.fbw == ptarg->fbw);
|
return (2 * frame.fbw == ptarg->fbw);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CRenderTargetMngr::PrintTargets()
|
void CRenderTargetMngr::PrintTargets()
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
for (MAPTARGETS::iterator it1 = mapDummyTargs.begin(); it1 != mapDummyTargs.end(); ++it1)
|
for (MAPTARGETS::iterator it1 = mapDummyTargs.begin(); it1 != mapDummyTargs.end(); ++it1)
|
||||||
|
@ -1232,7 +1228,7 @@ void ZeroGS::CRenderTargetMngr::PrintTargets()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZeroGS::CRenderTargetMngr::isFound(const frameInfo& frame, MAPTARGETS::iterator& it, u32 opts, u32 key, int maxposheight)
|
bool CRenderTargetMngr::isFound(const frameInfo& frame, MAPTARGETS::iterator& it, u32 opts, u32 key, int maxposheight)
|
||||||
{
|
{
|
||||||
// only enforce height if frame.fbh <= 0x1c0
|
// only enforce height if frame.fbh <= 0x1c0
|
||||||
bool bfound = it != mapTargets.end();
|
bool bfound = it != mapTargets.end();
|
||||||
|
@ -1286,7 +1282,7 @@ bool ZeroGS::CRenderTargetMngr::isFound(const frameInfo& frame, MAPTARGETS::iter
|
||||||
return bfound;
|
return bfound;
|
||||||
}
|
}
|
||||||
|
|
||||||
CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, u32 opts, int maxposheight)
|
CRenderTarget* CRenderTargetMngr::GetTarg(const frameInfo& frame, u32 opts, int maxposheight)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -1594,7 +1590,7 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, u32 op
|
||||||
return ptarg;
|
return ptarg;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroGS::CRenderTargetMngr::MAPTARGETS::iterator ZeroGS::CRenderTargetMngr::GetOldestTarg(MAPTARGETS& m)
|
CRenderTargetMngr::MAPTARGETS::iterator CRenderTargetMngr::GetOldestTarg(MAPTARGETS& m)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -1614,7 +1610,7 @@ ZeroGS::CRenderTargetMngr::MAPTARGETS::iterator ZeroGS::CRenderTargetMngr::GetOl
|
||||||
return itmaxtarg;
|
return itmaxtarg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CRenderTargetMngr::GetTargs(int start, int end, list<ZeroGS::CRenderTarget*>& listTargets) const
|
void CRenderTargetMngr::GetTargs(int start, int end, list<CRenderTarget*>& listTargets) const
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -1624,7 +1620,7 @@ void ZeroGS::CRenderTargetMngr::GetTargs(int start, int end, list<ZeroGS::CRende
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CRenderTargetMngr::Resolve(int start, int end)
|
void CRenderTargetMngr::Resolve(int start, int end)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -1635,7 +1631,7 @@ void ZeroGS::CRenderTargetMngr::Resolve(int start, int end)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CMemoryTargetMngr::Destroy()
|
void CMemoryTargetMngr::Destroy()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
listTargets.clear();
|
listTargets.clear();
|
||||||
|
@ -1689,7 +1685,7 @@ int memcmp_clut16(u16* pSavedBuffer, u16* pClutBuffer, int clutsize)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
bool ZeroGS::CMemoryTarget::ValidateClut(const tex0Info& tex0)
|
bool CMemoryTarget::ValidateClut(const tex0Info& tex0)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
assert(tex0.psm == psm && PSMT_ISCLUT(psm) && cpsm == tex0.cpsm);
|
assert(tex0.psm == psm && PSMT_ISCLUT(psm) && cpsm == tex0.cpsm);
|
||||||
|
@ -1723,7 +1719,7 @@ bool ZeroGS::CMemoryTarget::ValidateClut(const tex0Info& tex0)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool ZeroGS::CMemoryTarget::ValidateTex(const tex0Info& tex0, int starttex, int endtex, bool bDeleteBadTex)
|
bool CMemoryTarget::ValidateTex(const tex0Info& tex0, int starttex, int endtex, bool bDeleteBadTex)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -1895,7 +1891,7 @@ static __forceinline void BuildClut(u32 psm, u32 height, T* pclut, u8* psrc, T*
|
||||||
extern int g_MaxTexWidth, g_MaxTexHeight; // Maximum height & width of supported texture.
|
extern int g_MaxTexWidth, g_MaxTexHeight; // Maximum height & width of supported texture.
|
||||||
|
|
||||||
//#define SORT_TARGETS
|
//#define SORT_TARGETS
|
||||||
inline list<CMemoryTarget>::iterator ZeroGS::CMemoryTargetMngr::DestroyTargetIter(list<CMemoryTarget>::iterator& it)
|
inline list<CMemoryTarget>::iterator CMemoryTargetMngr::DestroyTargetIter(list<CMemoryTarget>::iterator& it)
|
||||||
{
|
{
|
||||||
// find the target and destroy
|
// find the target and destroy
|
||||||
list<CMemoryTarget>::iterator itprev = it;
|
list<CMemoryTarget>::iterator itprev = it;
|
||||||
|
@ -1910,7 +1906,7 @@ inline list<CMemoryTarget>::iterator ZeroGS::CMemoryTargetMngr::DestroyTargetIte
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZeroGS::CMemoryTargetMngr::CompareTarget(list<CMemoryTarget>::iterator& it, const tex0Info& tex0, int clutsize, int nClutOffset)
|
int CMemoryTargetMngr::CompareTarget(list<CMemoryTarget>::iterator& it, const tex0Info& tex0, int clutsize, int nClutOffset)
|
||||||
{
|
{
|
||||||
if (PSMT_ISCLUT(it->psm) != PSMT_ISCLUT(tex0.psm))
|
if (PSMT_ISCLUT(it->psm) != PSMT_ISCLUT(tex0.psm))
|
||||||
{
|
{
|
||||||
|
@ -1951,7 +1947,7 @@ int ZeroGS::CMemoryTargetMngr::CompareTarget(list<CMemoryTarget>::iterator& it,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CMemoryTargetMngr::GetClutVariables(int& nClutOffset, int& clutsize, const tex0Info& tex0)
|
void CMemoryTargetMngr::GetClutVariables(int& nClutOffset, int& clutsize, const tex0Info& tex0)
|
||||||
{
|
{
|
||||||
nClutOffset = 0;
|
nClutOffset = 0;
|
||||||
clutsize = 0;
|
clutsize = 0;
|
||||||
|
@ -1973,7 +1969,7 @@ void ZeroGS::CMemoryTargetMngr::GetClutVariables(int& nClutOffset, int& clutsize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CMemoryTargetMngr::GetMemAddress(int& start, int& end, const tex0Info& tex0)
|
void CMemoryTargetMngr::GetMemAddress(int& start, int& end, const tex0Info& tex0)
|
||||||
{
|
{
|
||||||
int nbStart, nbEnd;
|
int nbStart, nbEnd;
|
||||||
GetRectMemAddress(nbStart, nbEnd, tex0.psm, 0, 0, tex0.tw, tex0.th, tex0.tbp0, tex0.tbw);
|
GetRectMemAddress(nbStart, nbEnd, tex0.psm, 0, 0, tex0.tw, tex0.th, tex0.tbp0, tex0.tbw);
|
||||||
|
@ -1986,7 +1982,7 @@ void ZeroGS::CMemoryTargetMngr::GetMemAddress(int& start, int& end, const tex0I
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::SearchExistTarget(int start, int end, int nClutOffset, int clutsize, const tex0Info& tex0, int forcevalidate)
|
CMemoryTarget* CMemoryTargetMngr::SearchExistTarget(int start, int end, int nClutOffset, int clutsize, const tex0Info& tex0, int forcevalidate)
|
||||||
{
|
{
|
||||||
for (list<CMemoryTarget>::iterator it = listTargets.begin(); it != listTargets.end();)
|
for (list<CMemoryTarget>::iterator it = listTargets.begin(); it != listTargets.end();)
|
||||||
{
|
{
|
||||||
|
@ -2057,7 +2053,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::SearchExistTarget(int start, i
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::ClearedTargetsSearch(int fmt, int widthmult, int channels, int height)
|
CMemoryTarget* CMemoryTargetMngr::ClearedTargetsSearch(int fmt, int widthmult, int channels, int height)
|
||||||
{
|
{
|
||||||
CMemoryTarget* targ = NULL;
|
CMemoryTarget* targ = NULL;
|
||||||
|
|
||||||
|
@ -2098,7 +2094,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::ClearedTargetsSearch(int fmt,
|
||||||
return targ;
|
return targ;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info& tex0, int forcevalidate)
|
CMemoryTarget* CMemoryTargetMngr::GetMemoryTarget(const tex0Info& tex0, int forcevalidate)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
int start, end, nClutOffset, clutsize;
|
int start, end, nClutOffset, clutsize;
|
||||||
|
@ -2106,7 +2102,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info
|
||||||
GetClutVariables(nClutOffset, clutsize, tex0);
|
GetClutVariables(nClutOffset, clutsize, tex0);
|
||||||
GetMemAddress(start, end, tex0);
|
GetMemAddress(start, end, tex0);
|
||||||
|
|
||||||
ZeroGS::CMemoryTarget* it = SearchExistTarget(start, end, nClutOffset, clutsize, tex0, forcevalidate);
|
CMemoryTarget* it = SearchExistTarget(start, end, nClutOffset, clutsize, tex0, forcevalidate);
|
||||||
|
|
||||||
if (it != NULL) return it;
|
if (it != NULL) return it;
|
||||||
|
|
||||||
|
@ -2383,7 +2379,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info
|
||||||
return targ;
|
return targ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CMemoryTargetMngr::ClearRange(int nbStartY, int nbEndY)
|
void CMemoryTargetMngr::ClearRange(int nbStartY, int nbEndY)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
int starty = nbStartY / (4 * GPU_TEXWIDTH);
|
int starty = nbStartY / (4 * GPU_TEXWIDTH);
|
||||||
|
@ -2455,7 +2451,7 @@ void ZeroGS::CMemoryTargetMngr::ClearRange(int nbStartY, int nbEndY)
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CMemoryTargetMngr::DestroyCleared()
|
void CMemoryTargetMngr::DestroyCleared()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -2488,7 +2484,7 @@ void ZeroGS::CMemoryTargetMngr::DestroyCleared()
|
||||||
++curstamp;
|
++curstamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CMemoryTargetMngr::DestroyOldest()
|
void CMemoryTargetMngr::DestroyOldest()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -2511,7 +2507,7 @@ void ZeroGS::CMemoryTargetMngr::DestroyOldest()
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
// Texture Mngr For Bitwise AND Ops //
|
// Texture Mngr For Bitwise AND Ops //
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
void ZeroGS::CBitwiseTextureMngr::Destroy()
|
void CBitwiseTextureMngr::Destroy()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -2523,7 +2519,7 @@ void ZeroGS::CBitwiseTextureMngr::Destroy()
|
||||||
mapTextures.clear();
|
mapTextures.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 ZeroGS::CBitwiseTextureMngr::GetTexInt(u32 bitvalue, u32 ptexDoNotDelete)
|
u32 CBitwiseTextureMngr::GetTexInt(u32 bitvalue, u32 ptexDoNotDelete)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -2593,7 +2589,7 @@ u32 ZeroGS::CBitwiseTextureMngr::GetTexInt(u32 bitvalue, u32 ptexDoNotDelete)
|
||||||
return ptex;
|
return ptex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CRangeManager::RangeSanityCheck()
|
void CRangeManager::RangeSanityCheck()
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// sanity check
|
// sanity check
|
||||||
|
@ -2606,7 +2602,7 @@ void ZeroGS::CRangeManager::RangeSanityCheck()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::CRangeManager::Insert(int start, int end)
|
void CRangeManager::Insert(int start, int end)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
int imin = 0, imax = (int)ranges.size(), imid;
|
int imin = 0, imax = (int)ranges.size(), imid;
|
||||||
|
@ -2759,9 +2755,6 @@ void ZeroGS::CRangeManager::Insert(int start, int end)
|
||||||
RangeSanityCheck();
|
RangeSanityCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ZeroGS
|
|
||||||
{
|
|
||||||
|
|
||||||
CRangeManager s_RangeMngr; // manages overwritten memory
|
CRangeManager s_RangeMngr; // manages overwritten memory
|
||||||
|
|
||||||
void ResolveInRange(int start, int end)
|
void ResolveInRange(int start, int end)
|
||||||
|
@ -2892,7 +2885,7 @@ void FlushTransferRanges(const tex0Info* ptex)
|
||||||
|
|
||||||
// get start of left-most boundry page
|
// get start of left-most boundry page
|
||||||
int targstart, targend;
|
int targstart, targend;
|
||||||
ZeroGS::GetRectMemAddress(targstart, targend, ptarg->psm, 0, 0, ptarg->fbw, ptarg->fbh & ~(m_Blocks[ptarg->psm].height - 1), ptarg->fbp, ptarg->fbw);
|
GetRectMemAddress(targstart, targend, ptarg->psm, 0, 0, ptarg->fbw, ptarg->fbh & ~(m_Blocks[ptarg->psm].height - 1), ptarg->fbp, ptarg->fbw);
|
||||||
|
|
||||||
if (start >= targend)
|
if (start >= targend)
|
||||||
{
|
{
|
||||||
|
@ -2932,7 +2925,7 @@ void FlushTransferRanges(const tex0Info* ptex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroGS::g_MemTargs.ClearRange(start, end);
|
g_MemTargs.ClearRange(start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
s_RangeMngr.Clear();
|
s_RangeMngr.Clear();
|
||||||
|
@ -3756,5 +3749,3 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // End of namespece ZeroGS
|
|
||||||
|
|
|
@ -27,9 +27,6 @@
|
||||||
#define GL_TEXTURE_RECTANGLE GL_TEXTURE_RECTANGLE_NV
|
#define GL_TEXTURE_RECTANGLE GL_TEXTURE_RECTANGLE_NV
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace ZeroGS
|
|
||||||
{
|
|
||||||
|
|
||||||
inline u32 GetFrameKey(int fbp, int fbw, VB& curvb);
|
inline u32 GetFrameKey(int fbp, int fbw, VB& curvb);
|
||||||
|
|
||||||
// manages render targets
|
// manages render targets
|
||||||
|
@ -69,7 +66,7 @@ class CRenderTargetMngr
|
||||||
}
|
}
|
||||||
|
|
||||||
// gets all targets with a range
|
// gets all targets with a range
|
||||||
void GetTargs(int start, int end, list<ZeroGS::CRenderTarget*>& listTargets) const;
|
void GetTargs(int start, int end, list<CRenderTarget*>& listTargets) const;
|
||||||
|
|
||||||
// resolves all targets within a range
|
// resolves all targets within a range
|
||||||
__forceinline void Resolve(int start, int end);
|
__forceinline void Resolve(int start, int end);
|
||||||
|
@ -218,15 +215,15 @@ inline int RH(int tbh)
|
||||||
return (tbh << AA.y);
|
return (tbh << AA.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* inline void CreateTargetsList(int start, int end, list<ZeroGS::CRenderTarget*>& listTargs) {
|
/* inline void CreateTargetsList(int start, int end, list<CRenderTarget*>& listTargs) {
|
||||||
s_DepthRTs.GetTargs(start, end, listTargs);
|
s_DepthRTs.GetTargs(start, end, listTargs);
|
||||||
s_RTs.GetTargs(start, end, listTargs);
|
s_RTs.GetTargs(start, end, listTargs);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
// This pattern of functions is called 3 times, so I add creating Targets list into one.
|
// This pattern of functions is called 3 times, so I add creating Targets list into one.
|
||||||
inline list<ZeroGS::CRenderTarget*> CreateTargetsList(int start, int end)
|
inline list<CRenderTarget*> CreateTargetsList(int start, int end)
|
||||||
{
|
{
|
||||||
list<ZeroGS::CRenderTarget*> listTargs;
|
list<CRenderTarget*> listTargs;
|
||||||
s_DepthRTs.GetTargs(start, end, listTargs);
|
s_DepthRTs.GetTargs(start, end, listTargs);
|
||||||
s_RTs.GetTargs(start, end, listTargs);
|
s_RTs.GetTargs(start, end, listTargs);
|
||||||
return listTargs;
|
return listTargs;
|
||||||
|
@ -290,8 +287,6 @@ inline u32 GetFrameKeyDummy(CRenderTarget* frame)
|
||||||
return GetFrameKeyDummy(frame->fbp, frame->fbw, frame->fbh, frame->psm);
|
return GetFrameKeyDummy(frame->fbp, frame->fbw, frame->fbh, frame->psm);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End of namespace
|
|
||||||
|
|
||||||
#include "Mem.h"
|
#include "Mem.h"
|
||||||
|
|
||||||
static __forceinline void DrawTriangleArray()
|
static __forceinline void DrawTriangleArray()
|
||||||
|
|
|
@ -43,8 +43,6 @@ typedef void (APIENTRYP _PFNSWAPINTERVAL)(int);
|
||||||
|
|
||||||
//-------------------------- Extern variables
|
//-------------------------- Extern variables
|
||||||
|
|
||||||
using namespace ZeroGS;
|
|
||||||
|
|
||||||
extern u32 g_nGenVars, g_nTexVars, g_nAlphaVars, g_nResolve;
|
extern u32 g_nGenVars, g_nTexVars, g_nAlphaVars, g_nResolve;
|
||||||
extern char *libraryName;
|
extern char *libraryName;
|
||||||
extern int g_nFrame, g_nRealFrame;
|
extern int g_nFrame, g_nRealFrame;
|
||||||
|
@ -92,8 +90,6 @@ int s_nResolveCounts[30] = {0}; // resolve counts for last 30 frames
|
||||||
// State parameters
|
// State parameters
|
||||||
int nBackbufferWidth, nBackbufferHeight; // ZZ
|
int nBackbufferWidth, nBackbufferHeight; // ZZ
|
||||||
|
|
||||||
namespace ZeroGS
|
|
||||||
{
|
|
||||||
// = float4( 255.0 /256.0f, 255.0/65536.0f, 255.0f/(65535.0f*256.0f), 1.0f/(65536.0f*65536.0f));
|
// = float4( 255.0 /256.0f, 255.0/65536.0f, 255.0f/(65535.0f*256.0f), 1.0f/(65536.0f*65536.0f));
|
||||||
// float4 g_vdepth = float4( 65536.0f*65536.0f, 256.0f*65536.0f, 65536.0f, 256.0f);
|
// float4 g_vdepth = float4( 65536.0f*65536.0f, 256.0f*65536.0f, 65536.0f, 256.0f);
|
||||||
|
|
||||||
|
@ -144,8 +140,6 @@ DrawFn drawfn[8] = { KickDummy, KickDummy, KickDummy, KickDummy,
|
||||||
KickDummy, KickDummy, KickDummy, KickDummy
|
KickDummy, KickDummy, KickDummy, KickDummy
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // end namespace
|
|
||||||
|
|
||||||
// does one time only initializing/destruction
|
// does one time only initializing/destruction
|
||||||
|
|
||||||
class ZeroGSInit
|
class ZeroGSInit
|
||||||
|
@ -180,7 +174,7 @@ static ZeroGSInit s_ZeroGSInit;
|
||||||
#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8
|
#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ZeroGS::HandleGLError()
|
void HandleGLError()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
// check the error status of this framebuffer */
|
// check the error status of this framebuffer */
|
||||||
|
@ -241,7 +235,7 @@ void ZeroGS::HandleGLError()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::GSStateReset()
|
void ZZGSStateReset()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
icurctx = -1;
|
icurctx = -1;
|
||||||
|
@ -249,7 +243,7 @@ void ZeroGS::GSStateReset()
|
||||||
for (int i = 0; i < 2; ++i)
|
for (int i = 0; i < 2; ++i)
|
||||||
{
|
{
|
||||||
vb[i].Destroy();
|
vb[i].Destroy();
|
||||||
memset(&vb[i], 0, sizeof(ZeroGS::VB));
|
memset(&vb[i], 0, sizeof(VB));
|
||||||
|
|
||||||
vb[i].tex0.tw = 1;
|
vb[i].tex0.tw = 1;
|
||||||
vb[i].tex0.th = 1;
|
vb[i].tex0.th = 1;
|
||||||
|
@ -270,7 +264,7 @@ void ZeroGS::GSStateReset()
|
||||||
vb[1].ictx = 1;
|
vb[1].ictx = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::Reset()
|
void ZZReset()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
s_RTs.ResolveAll();
|
s_RTs.ResolveAll();
|
||||||
|
@ -285,8 +279,8 @@ void ZeroGS::Reset()
|
||||||
icurctx = -1;
|
icurctx = -1;
|
||||||
g_vsprog = g_psprog = 0;
|
g_vsprog = g_psprog = 0;
|
||||||
|
|
||||||
GSStateReset();
|
ZZGSStateReset();
|
||||||
Destroy(0);
|
ZZDestroy(0);
|
||||||
|
|
||||||
drawfn[0] = KickDummy;
|
drawfn[0] = KickDummy;
|
||||||
drawfn[1] = KickDummy;
|
drawfn[1] = KickDummy;
|
||||||
|
@ -298,13 +292,13 @@ void ZeroGS::Reset()
|
||||||
drawfn[7] = KickDummy;
|
drawfn[7] = KickDummy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::GSReset()
|
void ZZGSReset()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
memset(&gs, 0, sizeof(gs));
|
memset(&gs, 0, sizeof(gs));
|
||||||
|
|
||||||
ZeroGS::GSStateReset();
|
ZZGSStateReset();
|
||||||
|
|
||||||
gs.prac = 1;
|
gs.prac = 1;
|
||||||
prim = &gs._prim[0];
|
prim = &gs._prim[0];
|
||||||
|
@ -313,7 +307,7 @@ void ZeroGS::GSReset()
|
||||||
gs.q = 1;
|
gs.q = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::GSSoftReset(u32 mask)
|
void ZZGSSoftReset(u32 mask)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -326,7 +320,7 @@ void ZeroGS::GSSoftReset(u32 mask)
|
||||||
gs.nTriFanVert = -1;
|
gs.nTriFanVert = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::AddMessage(const char* pstr, u32 ms)
|
void ZZAddMessage(const char* pstr, u32 ms)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
listMsgs.push_back(MESSAGE(pstr, timeGetTime() + ms));
|
listMsgs.push_back(MESSAGE(pstr, timeGetTime() + ms));
|
||||||
|
@ -334,7 +328,7 @@ void ZeroGS::AddMessage(const char* pstr, u32 ms)
|
||||||
}
|
}
|
||||||
|
|
||||||
extern RasterFont* font_p;
|
extern RasterFont* font_p;
|
||||||
void ZeroGS::DrawText(const char* pstr, int left, int top, u32 color)
|
void DrawText(const char* pstr, int left, int top, u32 color)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
ZZshGLDisableProfile();
|
ZZshGLDisableProfile();
|
||||||
|
@ -348,7 +342,7 @@ void ZeroGS::DrawText(const char* pstr, int left, int top, u32 color)
|
||||||
ZZshGLEnableProfile();
|
ZZshGLEnableProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::ChangeWindowSize(int nNewWidth, int nNewHeight)
|
void ChangeWindowSize(int nNewWidth, int nNewHeight)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
nBackbufferWidth = max(nNewWidth, 16);
|
nBackbufferWidth = max(nNewWidth, 16);
|
||||||
|
@ -361,7 +355,7 @@ void ZeroGS::ChangeWindowSize(int nNewWidth, int nNewHeight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::SetChangeDeviceSize(int nNewWidth, int nNewHeight)
|
void SetChangeDeviceSize(int nNewWidth, int nNewHeight)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
s_nNewWidth = nNewWidth;
|
s_nNewWidth = nNewWidth;
|
||||||
|
@ -374,18 +368,18 @@ void ZeroGS::SetChangeDeviceSize(int nNewWidth, int nNewHeight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::ChangeDeviceSize(int nNewWidth, int nNewHeight)
|
void ChangeDeviceSize(int nNewWidth, int nNewHeight)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
//int oldscreen = s_nFullscreen;
|
//int oldscreen = s_nFullscreen;
|
||||||
|
|
||||||
int oldwidth = nBackbufferWidth, oldheight = nBackbufferHeight;
|
int oldwidth = nBackbufferWidth, oldheight = nBackbufferHeight;
|
||||||
|
|
||||||
if (!Create(nNewWidth&~7, nNewHeight&~7))
|
if (!ZZCreate(nNewWidth&~7, nNewHeight&~7))
|
||||||
{
|
{
|
||||||
ZZLog::Error_Log("Failed to recreate, changing to old device.");
|
ZZLog::Error_Log("Failed to recreate, changing to old device.");
|
||||||
|
|
||||||
if (Create(oldwidth, oldheight))
|
if (ZZCreate(oldwidth, oldheight))
|
||||||
{
|
{
|
||||||
SysMessage("Failed to create device, exiting...");
|
SysMessage("Failed to create device, exiting...");
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -401,7 +395,7 @@ void ZeroGS::ChangeDeviceSize(int nNewWidth, int nNewHeight)
|
||||||
assert(vb[0].pBufferData != NULL && vb[1].pBufferData != NULL);
|
assert(vb[0].pBufferData != NULL && vb[1].pBufferData != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::SetAA(int mode)
|
void SetAA(int mode)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
float f = 1.0f;
|
float f = 1.0f;
|
||||||
|
@ -437,7 +431,7 @@ void ZeroGS::SetAA(int mode)
|
||||||
glPointSize(f);
|
glPointSize(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::Prim()
|
void Prim()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -449,7 +443,7 @@ void ZeroGS::Prim()
|
||||||
curvb.curprim.prim = prim->prim;
|
curvb.curprim.prim = prim->prim;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::ProcessMessages()
|
void ProcessMessages()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -471,7 +465,7 @@ void ZeroGS::ProcessMessages()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::RenderCustom(float fAlpha)
|
void RenderCustom(float fAlpha)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
GL_REPORT_ERROR();
|
GL_REPORT_ERROR();
|
||||||
|
@ -591,7 +585,7 @@ static __forceinline void OUTPUT_VERT(VertexGPU vert, u32 id)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::KickPoint()
|
void KickPoint()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
assert(gs.primC >= 1);
|
assert(gs.primC >= 1);
|
||||||
|
@ -617,7 +611,7 @@ void ZeroGS::KickPoint()
|
||||||
OUTPUT_VERT(p[0], 0);
|
OUTPUT_VERT(p[0], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::KickLine()
|
void KickLine()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
assert(gs.primC >= 2);
|
assert(gs.primC >= 2);
|
||||||
|
@ -646,7 +640,7 @@ void ZeroGS::KickLine()
|
||||||
OUTPUT_VERT(p[1], 1);
|
OUTPUT_VERT(p[1], 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::KickTriangle()
|
void KickTriangle()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
assert(gs.primC >= 3);
|
assert(gs.primC >= 3);
|
||||||
|
@ -674,7 +668,7 @@ void ZeroGS::KickTriangle()
|
||||||
OUTPUT_VERT(p[2], 2);
|
OUTPUT_VERT(p[2], 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::KickTriangleFan()
|
void KickTriangleFan()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
assert(gs.primC >= 3);
|
assert(gs.primC >= 3);
|
||||||
|
@ -713,7 +707,7 @@ void SetKickVertex(VertexGPU *p, Vertex v, int next, const VB& curvb)
|
||||||
MOVFOG(p, v);
|
MOVFOG(p, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::KickSprite()
|
void KickSprite()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
assert(gs.primC >= 2);
|
assert(gs.primC >= 2);
|
||||||
|
@ -761,13 +755,13 @@ void ZeroGS::KickSprite()
|
||||||
OUTPUT_VERT(p[1], 1);
|
OUTPUT_VERT(p[1], 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::KickDummy()
|
void KickDummy()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
//ZZLog::Greg_Log("Kicking bad primitive: %.8x\n", *(u32*)prim);
|
//ZZLog::Greg_Log("Kicking bad primitive: %.8x\n", *(u32*)prim);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::SetFogColor(u32 fog)
|
void SetFogColor(u32 fog)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -776,7 +770,7 @@ void ZeroGS::SetFogColor(u32 fog)
|
||||||
// {
|
// {
|
||||||
gs.fogcol = fog;
|
gs.fogcol = fog;
|
||||||
|
|
||||||
ZeroGS::FlushBoth();
|
FlushBoth();
|
||||||
|
|
||||||
SetShaderCaller("SetFogColor");
|
SetShaderCaller("SetFogColor");
|
||||||
float4 v;
|
float4 v;
|
||||||
|
@ -788,7 +782,7 @@ void ZeroGS::SetFogColor(u32 fog)
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::SetFogColor(GIFRegFOGCOL* fog)
|
void SetFogColor(GIFRegFOGCOL* fog)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
|
@ -801,7 +795,7 @@ void ZeroGS::SetFogColor(GIFRegFOGCOL* fog)
|
||||||
ZZshSetParameter4fv(g_fparamFogColor, v, "g_fParamFogColor");
|
ZZshSetParameter4fv(g_fparamFogColor, v, "g_fParamFogColor");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::ExtWrite()
|
void ExtWrite()
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
ZZLog::Warn_Log("A hollow voice says 'EXTWRITE'! Nothing happens.");
|
ZZLog::Warn_Log("A hollow voice says 'EXTWRITE'! Nothing happens.");
|
||||||
|
@ -1053,7 +1047,7 @@ Return:
|
||||||
// 101 - cbp1 is compared with cbp. if different, clut data is loaded.
|
// 101 - cbp1 is compared with cbp. if different, clut data is loaded.
|
||||||
|
|
||||||
// GSdx sets cbp0 & cbp1 when checking for clut changes. ZeroGS sets them in texClutWrite.
|
// GSdx sets cbp0 & cbp1 when checking for clut changes. ZeroGS sets them in texClutWrite.
|
||||||
bool ZeroGS::CheckChangeInClut(u32 highdword, u32 psm)
|
bool CheckChangeInClut(u32 highdword, u32 psm)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
int cld = ZZOglGet_cld_TexBits(highdword);
|
int cld = ZZOglGet_cld_TexBits(highdword);
|
||||||
|
@ -1096,7 +1090,7 @@ bool ZeroGS::CheckChangeInClut(u32 highdword, u32 psm)
|
||||||
return IsDirty(highdword, psm, cld, cbp);
|
return IsDirty(highdword, psm, cld, cbp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroGS::texClutWrite(int ctx)
|
void texClutWrite(int ctx)
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
s_bTexFlush = false;
|
s_bTexFlush = false;
|
||||||
|
|
|
@ -96,9 +96,6 @@ extern u32 ptexLogo;
|
||||||
extern int nLogoWidth, nLogoHeight;
|
extern int nLogoWidth, nLogoHeight;
|
||||||
extern int nBackbufferWidth, nBackbufferHeight;
|
extern int nBackbufferWidth, nBackbufferHeight;
|
||||||
|
|
||||||
namespace ZeroGS
|
|
||||||
{
|
|
||||||
|
|
||||||
typedef void (*DrawFn)();
|
typedef void (*DrawFn)();
|
||||||
|
|
||||||
// managers render-to-texture targets
|
// managers render-to-texture targets
|
||||||
|
@ -419,7 +416,7 @@ extern vector<GLuint> g_vboBuffers; // VBOs for all drawing commands
|
||||||
extern GLuint vboRect;
|
extern GLuint vboRect;
|
||||||
extern int g_nCurVBOIndex;
|
extern int g_nCurVBOIndex;
|
||||||
|
|
||||||
void AddMessage(const char* pstr, u32 ms = 5000);
|
void ZZAddMessage(const char* pstr, u32 ms = 5000);
|
||||||
void DrawText(const char* pstr, int left, int top, u32 color);
|
void DrawText(const char* pstr, int left, int top, u32 color);
|
||||||
void ChangeWindowSize(int nNewWidth, int nNewHeight);
|
void ChangeWindowSize(int nNewWidth, int nNewHeight);
|
||||||
void SetChangeDeviceSize(int nNewWidth, int nNewHeight);
|
void SetChangeDeviceSize(int nNewWidth, int nNewHeight);
|
||||||
|
@ -432,13 +429,13 @@ void ReloadEffects();
|
||||||
// Methods //
|
// Methods //
|
||||||
bool IsGLExt(const char* szTargetExtension); ///< returns true if the the opengl extension is supported
|
bool IsGLExt(const char* szTargetExtension); ///< returns true if the the opengl extension is supported
|
||||||
inline bool Create_Window(int _width, int _height);
|
inline bool Create_Window(int _width, int _height);
|
||||||
bool Create(int width, int height);
|
bool ZZCreate(int width, int height);
|
||||||
void Destroy(bool bD3D);
|
void ZZDestroy(bool bD3D);
|
||||||
|
|
||||||
void Reset(); // call to destroy video resources
|
void ZZReset(); // call to destroy video resources
|
||||||
void GSStateReset();
|
void ZZGSStateReset();
|
||||||
void GSReset();
|
void ZZGSReset();
|
||||||
void GSSoftReset(u32 mask);
|
void ZZGSSoftReset(u32 mask);
|
||||||
|
|
||||||
void HandleGLError();
|
void HandleGLError();
|
||||||
|
|
||||||
|
@ -482,8 +479,8 @@ bool CheckChangeInClut(u32 highdword, u32 psm); // returns true if clut will cha
|
||||||
// call to load CLUT data (depending on CLD)
|
// call to load CLUT data (depending on CLD)
|
||||||
void texClutWrite(int ctx);
|
void texClutWrite(int ctx);
|
||||||
|
|
||||||
int Save(s8* pbydata);
|
int ZZSave(s8* pbydata);
|
||||||
bool Load(s8* pbydata);
|
bool ZZLoad(s8* pbydata);
|
||||||
|
|
||||||
void SaveSnapshot(const char* filename);
|
void SaveSnapshot(const char* filename);
|
||||||
bool SaveRenderTarget(const char* filename, int width, int height, int jpeg);
|
bool SaveRenderTarget(const char* filename, int width, int height, int jpeg);
|
||||||
|
@ -522,7 +519,7 @@ inline void CluttingForFlushedTex(tex0Info* tex0, u32 Data, int ictx)
|
||||||
tex0->csa = ZZOglGet_csa_TexBits(Data);
|
tex0->csa = ZZOglGet_csa_TexBits(Data);
|
||||||
tex0->cld = ZZOglGet_cld_TexBits(Data);
|
tex0->cld = ZZOglGet_cld_TexBits(Data);
|
||||||
|
|
||||||
ZeroGS::texClutWrite(ictx);
|
texClutWrite(ictx);
|
||||||
};
|
};
|
||||||
|
|
||||||
// The size in bytes of x strings (of texture).
|
// The size in bytes of x strings (of texture).
|
||||||
|
@ -542,6 +539,4 @@ inline u8* _MemoryAddress(int x)
|
||||||
{
|
{
|
||||||
return g_pbyGSMemory + mult * x;
|
return g_pbyGSMemory + mult * x;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue