zzogl-pg: Enable a GifTransfer shortcut from GSdx. Comment out two variables that weren't being used.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3382 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2010-07-04 03:53:01 +00:00
parent dd42d14410
commit cc47fdbb8c
10 changed files with 54 additions and 55 deletions

View File

@ -112,17 +112,18 @@ template<int index> void _GSgifTransfer(u32 *pMem, u32 size)
// first try a shortcut for a very common case
/*if(path.adonly && size >= path.nloop)
if (path->adonly && size >= path->nloop)
{
size -= path.nloop;
size -= path->nloop;
do
{
GIFPackedRegHandlerA_D(pMem);
mem += sizeof(GIFPackedReg);
pMem += sizeof(GIFPackedReg);
}
while(--path->nloop > 0);
}
while(--path.nloop > 0);*/
do
{

View File

@ -86,12 +86,14 @@ typedef struct
nloop = tag.NLOOP;
eop = tag.EOP;
mode = tag.FLG;
adonly = false;
// Hmm....
nreg = tag.NREG << 2;
if (nreg == 0) nreg = 64;
regs = tag.REGS;
reg = 0;
if ((nreg == 4) && (regs == GIF_REG_A_D)) adonly == true;
// ZZLog::GS_Log("GIFtag: %8.8lx_%8.8lx_%8.8lx_%8.8lx: EOP=%d, NLOOP=%x, FLG=%x, NREG=%d, PRE=%d",
// data[3], data[2], data[1], data[0],

View File

@ -137,8 +137,8 @@ inline void FrameSavingHelper()
#endif
}
g_SaveFrameNum = 0;
g_bSaveFlushedFrame = 1;
// g_SaveFrameNum = 0;
// g_bSaveFlushedFrame = 1;
}
// Function populated tex0Info[2] array
@ -743,7 +743,7 @@ inline void AfterRendererUnimportantJob()
AfterRenderCountStatistics();
if (s_nNewWidth >= 0 && s_nNewHeight >= 0 && !g_bIsLost)
if (s_nNewWidth >= 0 && s_nNewHeight >= 0/* && !g_bIsLost*/)
AfterRendererResizeWindow();
maxmin = 608;
@ -831,7 +831,7 @@ int count = 0;
// The main renderer function
void ZeroGS::RenderCRTC(int interlace)
{
if (g_bIsLost || FrameSkippingHelper()) return;
if (/*g_bIsLost || */FrameSkippingHelper()) return;
u32 bInterlace = SMODE2->INT && SMODE2->FFMD && (conf.interlace < 2);

View File

@ -13,13 +13,13 @@ extern HDC hDC; // Private GDI Device Context
extern HGLRC hRC; // Permanent Rendering Context
#endif
extern bool g_bIsLost;
//extern bool g_bIsLost;
extern int s_frameskipping;
extern float fFPS;
extern unsigned char zgsrevision, zgsbuild, zgsminor;
extern u32 g_SaveFrameNum;
//extern u32 g_SaveFrameNum;
extern int s_nWriteDepthCount;
extern int s_nWireframeCount;
extern int s_nWriteDestAlphaTest;

View File

@ -180,7 +180,7 @@ u32 ptexBilinearBlocks = 0;
u32 ptexConv32to16 = 0;
bool g_bDisplayMsg = 1;
int g_nDepthBias = 0;
u32 g_bSaveFlushedFrame = 0;
//u32 g_bSaveFlushedFrame = 0;
//------------------ Code
@ -882,7 +882,7 @@ bool ZeroGS::Create(int _width, int _height)
vb[0].Init(VB_BUFFERSIZE);
vb[1].Init(VB_BUFFERSIZE);
g_bSaveFlushedFrame = 1;
// g_bSaveFlushedFrame = 1;
g_vsprog = g_psprog = 0;

View File

@ -117,11 +117,11 @@ void Draw(const VB& curvb)
//------------------ variables
extern bool g_bIsLost;
//extern bool g_bIsLost;
extern int g_nDepthBias;
extern float g_fBlockMult;
bool g_bUpdateStencil = 1;
u32 g_SaveFrameNum = 0; // ZZ
//u32 g_SaveFrameNum = 0; // ZZ
int GPU_TEXWIDTH = 512;
float g_fiGPU_TEXWIDTH = 1 / 512.0f;
@ -143,7 +143,7 @@ static const u32 g_dwZCmp[] = { GL_NEVER, GL_ALWAYS, GL_GEQUAL, GL_GREATER };
/////////////////////
// graphics resources
#define s_bForceTexFlush 1 // ZZ
u32 s_ptexCurSet[2] = {0};
static u32 s_ptexCurSet[2] = {0};
static u32 s_ptexNextSet[2] = {0}; // ZZ
@ -160,7 +160,7 @@ int s_nWriteDestAlphaTest = 0; // ZZ
// State parameters
static Vector vAlphaBlendColor; // used for GPU_COLOR
static u8 bNeedBlendFactorInAlpha; // set if the output source alpha is different from the real source alpha (only when blend factor > 0x80)
static bool bNeedBlendFactorInAlpha; // set if the output source alpha is different from the real source alpha (only when blend factor > 0x80)
static u32 s_dwColorWrite = 0xf; // the color write mask of the current target
union
@ -185,7 +185,7 @@ union
int g_PrevBitwiseTexX = -1, g_PrevBitwiseTexY = -1; // textures stored in SAMP_BITWISEANDX and SAMP_BITWISEANDY // ZZ
static alphaInfo s_alphaInfo; // ZZ
//static alphaInfo s_alphaInfo; // ZZ
extern u8* g_pbyGSClut;
extern int ppf;
@ -339,7 +339,8 @@ inline void VisualBufferMessage(int context)
ZZLog::Error_Log("TGA name '%s'.", Name);
free(Name);
// }
ZZLog::Debug_Log("frame: %d, buffer %ld.\n", g_SaveFrameNum, BufferNumber);
// ZZLog::Debug_Log("frame: %d, buffer %ld.\n", g_SaveFrameNum, BufferNumber);
ZZLog::Debug_Log("buffer %ld.\n", BufferNumber);
#endif
}
@ -347,12 +348,12 @@ inline void SaveRendererTarget(VB& curvb)
{
#ifdef _DEBUG
if (g_bSaveFlushedFrame & 0x80000000)
{
char str[255];
sprintf(str, "rndr%d.tga", g_SaveFrameNum);
SaveRenderTarget(str, curvb.prndr->fbw, curvb.prndr->fbh, 0);
}
// if (g_bSaveFlushedFrame & 0x80000000)
// {
// char str[255];
// sprintf(str, "rndr%d.tga", g_SaveFrameNum);
// SaveRenderTarget(str, curvb.prndr->fbw, curvb.prndr->fbh, 0);
// }
#endif
}
@ -374,7 +375,7 @@ inline void FlushUpdateEffect()
// Check, maybe we cold skip flush
inline bool IsFlushNoNeed(VB& curvb, const pixTest& curtest)
{
if (curvb.nCount == 0 || (curtest.zte && curtest.ztst == 0) || g_bIsLost)
if (curvb.nCount == 0 || (curtest.zte && curtest.ztst == 0) /*|| g_bIsLost*/)
{
curvb.nCount = 0;
return true;
@ -818,7 +819,7 @@ inline int FlushGetShaderType(VB& curvb, CRenderTarget* ptextarg, GLuint& ptexcl
}
//Set page offsets depends omn shader type.
//Set page offsets depends on shader type.
inline Vector FlushSetPageOffset(FRAGMENTSHADER* pfragment, int shadertype, CRenderTarget* ptextarg)
{
SetShaderCaller("FlushSetPageOffset");
@ -936,8 +937,8 @@ inline void FlushApplyResizeFilter(VB& curvb, u32& dwFilterOpts, CRenderTarget*
}
// Usage existing targets depends on several tricks, 32-16 conversion and CLUTing, so we need handle it.
inline FRAGMENTSHADER* FlushUseExistRenderTaget(VB& curvb, CRenderTarget* ptextarg, u32& dwFilterOpts, int exactcolor, int context)
// Usage existing targets depends on several tricks, 32-16 conversion and CLUTing, so we need to handle it.
inline FRAGMENTSHADER* FlushUseExistRenderTarget(VB& curvb, CRenderTarget* ptextarg, u32& dwFilterOpts, int exactcolor, int context)
{
if (ptextarg->IsDepth())
SetWriteDepth();
@ -990,7 +991,6 @@ inline FRAGMENTSHADER* FlushMadeNewTarget(VB& curvb, int exactcolor, int context
}
FRAGMENTSHADER* pfragment = LoadShadeEffect(0, GetTexFilter(curvb.tex1), curvb.curprim.fge,
IsAlphaTestExpansion(curvb), exactcolor, curvb.clamp, context, NULL);
if (pfragment == NULL)
@ -1046,7 +1046,7 @@ inline FRAGMENTSHADER* FlushRendererStage(VB& curvb, u32& dwFilterOpts, CRenderT
if (curvb.curprim.tme)
{
if (ptextarg != NULL)
pfragment = FlushUseExistRenderTaget(curvb, ptextarg, dwFilterOpts, exactcolor, context);
pfragment = FlushUseExistRenderTarget(curvb, ptextarg, dwFilterOpts, exactcolor, context);
else
pfragment = FlushMadeNewTarget(curvb, exactcolor, context);
@ -1288,9 +1288,7 @@ inline void AlphaPabe(VB& curvb, FRAGMENTSHADER* pfragment, int exactcolor)
// First three cases are trivial manual.
inline bool AlphaFailureIgnore(const pixTest curtest)
{
if (!curtest.ate) return true;
if (curtest.atst == 1) return true;
if (curtest.afail == 0) return true;
if ((!curtest.ate) || (curtest.atst == 1) || (curtest.afail == 0)) return true;
if (conf.settings().no_alpha_fail && ((s_dwColorWrite < 8) || (s_dwColorWrite == 15 && curtest.atst == 5 && (curtest.aref == 64))))
return true;
@ -1561,8 +1559,7 @@ void ZeroGS::Flush(int context)
SwitchWireframeOff();
FlushDoContextJob(curvb, context);
u32 dwUsingSpecialTesting = 0;
u32 dwFilterOpts = 0;
u32 dwUsingSpecialTesting = 0, dwFilterOpts = 0;
int exactcolor = FlushGetExactcolor(curtest);
FRAGMENTSHADER* pfragment = FlushRendererStage(curvb, dwFilterOpts, ptextarg, exactcolor, context);
@ -2407,7 +2404,7 @@ void ZeroGS::SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0,
break; \
\
case 2: \
bNeedBlendFactorInAlpha = 1; /* should disable alpha channel writing */ \
bNeedBlendFactorInAlpha = true; /* should disable alpha channel writing */ \
vAlphaBlendColor.y = 0; \
vAlphaBlendColor.w = (sign) ? (float)a.fix * (2.0f/255.0f) : (float)a.fix * (-2.0f/255.0f); \
usec = 0; /* change so that alpha comes from source*/ \
@ -2431,7 +2428,7 @@ inline void ZeroGS::NeedFactor(int w)
{
if (bDestAlphaColor == 2)
{
bNeedBlendFactorInAlpha = (w + 1) ? 1 : 0;
bNeedBlendFactorInAlpha = (w + 1) ? true : false;
vAlphaBlendColor.y = 0;
vAlphaBlendColor.w = (float)w;
}
@ -2446,7 +2443,7 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a)
// TODO: negative color when not clamping turns to positive???
g_vars._bAlphaState = 0; // set all to zero
bNeedBlendFactorInAlpha = 0;
bNeedBlendFactorInAlpha = false;
b2XAlphaTest = 1;
//u32 dwTemp = 0xffffffff;
bDestAlphaColor = 0;
@ -2457,7 +2454,7 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a)
s_alphaeq = GL_FUNC_ADD;
s_rgbeq = 1;
s_alphaInfo = a;
// s_alphaInfo = a;
vAlphaBlendColor = Vector(1, 2 * 255.0f / 256.0f, 0, 0);
u32 usec = a.c;

View File

@ -47,6 +47,7 @@ extern u32 ptexConv32to16;
bool g_bCRTCBilinear = true;
u8* s_lpShaderResources = NULL;
map<int, SHADERHEADER*> mapShaderResources;
CGcontext g_cgcontext;
//------------------ Code

View File

@ -32,7 +32,7 @@
using namespace ZeroGS;
extern int g_TransferredToGPU;
extern bool g_bIsLost;
//extern bool g_bIsLost;
extern bool g_bUpdateStencil;
#if !defined(ZEROGS_DEVBUILD)
@ -56,7 +56,7 @@ CBitwiseTextureMngr s_BitwiseTextures;
CMemoryTargetMngr g_MemTargs;
}
extern u32 s_ptexCurSet[2];
//extern u32 s_ptexCurSet[2];
bool g_bSaveZUpdate = 0;
int VALIDATE_THRESH = 8;
@ -2934,8 +2934,7 @@ void InitTransferHostLocal()
{
FUNCLOG
if (g_bIsLost)
return;
//if (g_bIsLost) return;
#if defined(ZEROGS_DEVBUILD)
if (gs.trxpos.dx + gs.imageWnew > gs.dstbuf.bw)
@ -3009,7 +3008,7 @@ void TransferHostLocal(const void* pbyMem, u32 nQWordSize)
{
FUNCLOG
if (g_bIsLost) return;
// if (g_bIsLost) return;
int start, end;

View File

@ -49,7 +49,7 @@ extern int g_nFrame, g_nRealFrame;
// Context is lost -- could not draw.
// Setting this variable to true is also lost. Fixme.
bool g_bIsLost = false;
//bool g_bIsLost = false;
primInfo *prim;
CGprogram g_vsprog = 0, g_psprog = 0; // 2 -- ZZ
@ -91,7 +91,6 @@ int s_nResolveCounts[30] = {0}; // resolve counts for last 30 frames
////////////////////
// State parameters
CGcontext g_cgcontext;
int nBackbufferWidth, nBackbufferHeight;
u8* g_pbyGSMemory = NULL; // 4Mb GS system mem
@ -487,7 +486,7 @@ void ZeroGS::Prim()
{
FUNCLOG
if (g_bIsLost) return;
// if (g_bIsLost) return;
VB& curvb = vb[prim->ctxt];
@ -585,14 +584,14 @@ void ZeroGS::RenderCustom(float fAlpha)
void ZeroGS::Restore()
{
FUNCLOG
if (!g_bIsLost) return;
return;
/*if (!g_bIsLost) return;
//if( SUCCEEDED(pd3dDevice->Reset(&d3dpp)) ) {
g_bIsLost = false;
// handle lost states
ZeroGS::ChangeDeviceSize(nBackbufferWidth, nBackbufferHeight);
ZeroGS::ChangeDeviceSize(nBackbufferWidth, nBackbufferHeight);*/
//}
}
@ -871,8 +870,8 @@ void ZeroGS::SetFogColor(u32 fog)
ZeroGS::FlushBoth();
if (!g_bIsLost)
{
//if (!g_bIsLost)
//{
SetShaderCaller("SetFogColor");
Vector v;
@ -882,7 +881,7 @@ void ZeroGS::SetFogColor(u32 fog)
// v.z = ((gs.fogcol >> 16) & 0xff) / 255.0f;
v.SetColor(gs.fogcol);
ZZcgSetParameter4fv(g_fparamFogColor, v, "g_fParamFogColor");
}
//}
// }
}
@ -1126,7 +1125,7 @@ void ZeroGS::texClutWrite(int ctx)
FUNCLOG
s_bTexFlush = false;
if (g_bIsLost) return;
//if (g_bIsLost) return;
tex0Info& tex0 = vb[ctx].tex0;

View File

@ -89,7 +89,7 @@ extern u32 ptexBilinearBlocks;
// this is currently *not* used as a bool, in spite of its moniker --air
// Actually, the only thing written to it is 1 or 0, which makes the (g_bSaveFlushedFrame & 0x80000000) check rather bizzare.
extern u32 g_bSaveFlushedFrame;
//extern u32 g_bSaveFlushedFrame;
//////////////////////////
// State parameters