zzogl-pg: Remove some remanents of negAA. Mess with the aa code a bit. Add a function for a commonly done operation. Increment the version, since I haven't done that in a long time.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3758 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2010-09-13 04:57:03 +00:00
parent 647f84d08e
commit 6528f4b479
15 changed files with 72 additions and 73 deletions

View File

@ -301,6 +301,7 @@ void GLWindow::SwapGLBuffers()
{
static u32 lastswaptime = 0;
SwapBuffers(hDC);
//glClear(GL_COLOR_BUFFER_BIT);
lastswaptime = timeGetTime();
}

View File

@ -299,6 +299,7 @@ bool GLWindow::DisplayWindow(int _width, int _height)
void GLWindow::SwapGLBuffers()
{
glXSwapBuffers(glDisplay, glWindow);
//glClear(GL_COLOR_BUFFER_BIT);
}
void GLWindow::SetTitle(char *strtitle)

View File

@ -507,6 +507,10 @@ typedef struct
GIFRegDIMX dimx;
GSMemory mem;
GSClut clut_buffer;
int primNext(int inc = 1)
{
return ((primIndex + inc) % ARRAY_SIZE(gsvertex));
}
void setRGBA(u32 r, u32 g, u32 b, u32 a)
{
@ -523,7 +527,7 @@ typedef struct
vertexregs.z = z;
vertexregs.f = f;
gsvertex[primIndex] = vertexregs;
primIndex = (primIndex + 1) % ARRAY_SIZE(gsvertex);
primIndex = primNext();
}
void add_vertex(u16 x, u16 y, u32 z)
@ -532,7 +536,7 @@ typedef struct
vertexregs.y = y;
vertexregs.z = z;
gsvertex[primIndex] = vertexregs;
primIndex = (primIndex + 1) % ARRAY_SIZE(gsvertex);
primIndex = primNext();
}
} GSinternal;

View File

@ -64,12 +64,11 @@ bool SaveStateExists = true; // We could not know save slot status before first
const char* SaveStateFile = NULL; // Name of SaveFile for access check.
extern const char* s_aa[5];
extern const char* s_naa[3];
extern const char* pbilinear[];
// statistics
u32 g_nGenVars = 0, g_nTexVars = 0, g_nAlphaVars = 0, g_nResolve = 0;
#define VER 1
#define VER 2
const unsigned char zgsversion = PS2E_GS_VERSION;
unsigned char zgsrevision = 0; // revision and build gives plugin version
unsigned char zgsbuild = VER;
@ -477,8 +476,7 @@ static __forceinline void SetGSTitle()
SaveStateExists = true;
sprintf(strtitle, "ZZ Open GL 0.%d.%d | %.1f fps | %s%s%s savestate %d%s | shaders %s | (%.1f)", zgsbuild, zgsminor, fFPS,
g_pInterlace[conf.interlace], g_pBilinear[conf.bilinear],
(conf.aa >= conf.negaa) ? (conf.aa ? s_aa[conf.aa - conf.negaa] : "") : (conf.negaa ? s_naa[conf.negaa - conf.aa] : ""),
g_pInterlace[conf.interlace], g_pBilinear[conf.bilinear], (conf.aa ? s_aa[conf.aa] : ""),
CurrentSavestate, (SaveStateExists ? "" : "*"),
g_pShaders[g_nPixelShaderVer], (ppf&0xfffff) / (float)UPDATE_FRAMES);

View File

@ -390,8 +390,6 @@ void DisplayDialog()
if (gtk_combo_box_get_active(GTK_COMBO_BOX(aa_box)) != -1)
conf.aa = gtk_combo_box_get_active(GTK_COMBO_BOX(aa_box));
conf.negaa = 0;
conf.log = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(log_check));
conf.bilinear = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(bilinear_check));
fake_options.widescreen = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widescreen_check));

View File

@ -140,7 +140,7 @@ void __gifCall KickVertex(bool adc)
{
/* tri fans need special processing */
if (gs.nTriFanVert == gs.primIndex)
gs.primIndex = (gs.primIndex + 1) % ArraySize(gs.gsvertex);
gs.primIndex = gs.primNext();
}
}
}

View File

@ -148,7 +148,7 @@ void __forceinline KICK_VERTEX3()
{
/* tri fans need special processing */
if (gs.nTriFanVert == gs.primIndex)
gs.primIndex = (gs.primIndex + 1) % ArraySize(gs.gsvertex);
gs.primIndex = gs.primNext();
}
}
}
@ -161,7 +161,7 @@ void __gifCall GIFPackedRegHandlerXYZF2(const u32* data)
gs.vertexregs.z = (data[2] >> 4) & 0xffffff;
gs.vertexregs.f = (data[3] >> 4) & 0xff;
gs.gsvertex[gs.primIndex] = gs.vertexregs;
gs.primIndex = (gs.primIndex + 1) % ArraySize(gs.gsvertex);
gs.primIndex = gs.primNext();
if (data[3] & 0x8000)
{
@ -180,7 +180,7 @@ void __gifCall GIFPackedRegHandlerXYZ2(const u32* data)
gs.vertexregs.y = (data[1] >> 0) & 0xffff;
gs.vertexregs.z = data[2];
gs.gsvertex[gs.primIndex] = gs.vertexregs;
gs.primIndex = (gs.primIndex + 1) % ArraySize(gs.gsvertex);
gs.primIndex = gs.primNext();
if (data[3] & 0x8000)
{
@ -429,7 +429,7 @@ void __gifCall GIFRegHandlerXYZF2(const u32* data)
gs.vertexregs.z = data[1] & 0xffffff;
gs.vertexregs.f = data[1] >> 24;
gs.gsvertex[gs.primIndex] = gs.vertexregs;
gs.primIndex = (gs.primIndex + 1) % ARRAY_SIZE(gs.gsvertex);
gs.primIndex = gs.primNext();
KICK_VERTEX2();
}
@ -441,7 +441,7 @@ void __gifCall GIFRegHandlerXYZ2(const u32* data)
gs.vertexregs.y = (data[0] >> (16)) & 0xffff;
gs.vertexregs.z = data[1];
gs.gsvertex[gs.primIndex] = gs.vertexregs;
gs.primIndex = (gs.primIndex + 1) % ARRAY_SIZE(gs.gsvertex);
gs.primIndex = gs.primNext();
KICK_VERTEX2();
}
@ -497,7 +497,7 @@ void __gifCall GIFRegHandlerXYZF3(const u32* data)
gs.vertexregs.z = data[1] & 0xffffff;
gs.vertexregs.f = data[1] >> 24;
gs.gsvertex[gs.primIndex] = gs.vertexregs;
gs.primIndex = (gs.primIndex + 1) % ARRAY_SIZE(gs.gsvertex);
gs.primIndex = gs.primNext();
KICK_VERTEX3();
}
@ -509,7 +509,7 @@ void __gifCall GIFRegHandlerXYZ3(const u32* data)
gs.vertexregs.y = (data[0] >> (16)) & 0xffff;
gs.vertexregs.z = data[1];
gs.gsvertex[gs.primIndex] = gs.vertexregs;
gs.primIndex = (gs.primIndex + 1) % ARRAY_SIZE(gs.gsvertex);
gs.primIndex = gs.primNext();
KICK_VERTEX3();
}

View File

@ -201,7 +201,6 @@ typedef struct
u8 mrtdepth; // write color in render target
u8 interlace; // intelacing mode 0, 1, 3-off
u8 aa; // antialiasing 0 - off, 1 - 2x, 2 - 4x, 3 - 8x, 4 - 16x
u8 negaa; // negative aliasing
u8 bilinear; // set to enable bilinear support. 0 - off, 1 -- on, 2 -- force (use for textures that usually need it)
ZZOptions zz_options;
gameHacks hacks; // game options -- different hacks.

View File

@ -169,7 +169,6 @@ void OnOK(HWND hW)
conf.aa = 0;
}
conf.negaa = 0;
conf.zz_options._u32 = 0;
conf.zz_options.capture_avi = IsDlgButtonChecked(hW, IDC_CONFIG_CAPTUREAVI) ? 1 : 0;

View File

@ -34,7 +34,6 @@ extern u32 THR_KeyEvent; // value for passing out key events between threads
extern bool THR_bShift, SaveStateExists;
const char* s_aa[5] = { "AA none |", "AA 2x |", "AA 4x |", "AA 8x |", "AA 16x |" };
const char* s_naa[3] = { "native res |", "res /2 |", "res /4 |" };
const char* pbilinear[] = { "off", "normal", "forced" };

View File

@ -177,7 +177,6 @@ inline void FrameObtainDispinfo(u32 bInterlace, tex0Info* dispinfo)
}
}
// Something should be done before Renderering the picture.
inline void RenderStartHelper(u32 bInterlace)
{
@ -191,6 +190,7 @@ inline void RenderStartHelper(u32 bInterlace)
// return;
// }
//#endif
if (conf.mrtdepth && pvs[8] == NULL)
{
conf.mrtdepth = 0;

View File

@ -200,6 +200,7 @@ VB vb[2];
float fiTexWidth[2], fiTexHeight[2]; // current tex width and height
u8 s_AAx = 0, s_AAy = 0; // if AAy is set, then AAx has to be set
Point AA = {0,0};
int icurctx = -1;

View File

@ -457,7 +457,7 @@ void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth)
}
else
{
u32 bit_idx = (s_AAx == 0) ? 0 : 1;
u32 bit_idx = (AA.x == 0) ? 0 : 1;
// align the rect to the nearest page
// note that fbp is always aligned on page boundaries
@ -471,7 +471,7 @@ void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth)
// write color and zero out stencil buf, always 0 context!
// force bilinear if using AA
// Fix in r133 -- FFX movies and Gust backgrounds!
//SetTexVariablesInt(0, 0*(s_AAx || s_AAy)?2:0, texframe, false, &ppsBitBlt[!!s_AAx], 1);
//SetTexVariablesInt(0, 0*(AA.x || AA.y) ? 2 : 0, texframe, false, &ppsBitBlt[!!s_AAx], 1);
SetTexVariablesInt(0, 0, texframe, false, &ppsBitBlt[bit_idx], 1);
ZZshGLSetTextureParameter(ppsBitBlt[bit_idx].sMemory, vb[0].pmemtarg->ptex->tex, "BitBlt.memory");
@ -755,7 +755,7 @@ void ZeroGS::CRenderTarget::_CreateFeedback()
// tex coords, test ffx bikanel island when changing these
// Vector v = Vector(1, -1, 0.5f / (fbw<<s_AAx), 0.5f / (fbh << s_AAy));
// Vector v = Vector(1, -1, 0.5f / (fbw << AA.x), 0.5f / (fbh << AA.y));
// v *= 1/32767.0f;
// cgGLSetParameter4fv(pvsBitBlt.sBitBltPos, v);
Vector v = DefaultBitBltPos();
@ -3087,11 +3087,11 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo
case PSMCT24:
if (s_AAy)
if (AA.y)
{
RESOLVE_32BIT(32, u32, u32, 32A4, 8, 8, (u32), Frame, s_AAx, s_AAy);
RESOLVE_32BIT(32, u32, u32, 32A4, 8, 8, (u32), Frame, AA.x, AA.y);
}
else if (s_AAx)
else if (AA.x)
{
RESOLVE_32BIT(32, u32, u32, 32A2, 8, 8, (u32), Frame, 1, 0);
}
@ -3104,11 +3104,11 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo
case PSMCT16:
if (s_AAy)
if (AA.y)
{
RESOLVE_32BIT(16, u16, u32, 16A4, 16, 8, RGBA32to16, Frame, s_AAx, s_AAy);
RESOLVE_32BIT(16, u16, u32, 16A4, 16, 8, RGBA32to16, Frame, AA.x, AA.y);
}
else if (s_AAx)
else if (AA.x)
{
RESOLVE_32BIT(16, u16, u32, 16A2, 16, 8, RGBA32to16, Frame, 1, 0);
}
@ -3121,11 +3121,11 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo
case PSMCT16S:
if (s_AAy)
if (AA.y)
{
RESOLVE_32BIT(16S, u16, u32, 16A4, 16, 8, RGBA32to16, Frame, s_AAx, s_AAy);
RESOLVE_32BIT(16S, u16, u32, 16A4, 16, 8, RGBA32to16, Frame, AA.x, AA.y);
}
else if (s_AAx)
else if (AA.x)
{
RESOLVE_32BIT(16S, u16, u32, 16A2, 16, 8, RGBA32to16, Frame, 1, 0);
}
@ -3140,11 +3140,11 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo
case PSMT24Z:
if (s_AAy)
if (AA.y)
{
RESOLVE_32BIT(32Z, u32, u32, 32A4, 8, 8, (u32), Frame, s_AAx, s_AAy);
RESOLVE_32BIT(32Z, u32, u32, 32A4, 8, 8, (u32), Frame, AA.x, AA.y);
}
else if (s_AAx)
else if (AA.x)
{
RESOLVE_32BIT(32Z, u32, u32, 32A2, 8, 8, (u32), Frame, 1, 0);
}
@ -3157,11 +3157,11 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo
case PSMT16Z:
if (s_AAy)
if (AA.y)
{
RESOLVE_32BIT(16Z, u16, u32, 16A4, 16, 8, (u16), Frame, s_AAx, s_AAy);
RESOLVE_32BIT(16Z, u16, u32, 16A4, 16, 8, (u16), Frame, AA.x, AA.y);
}
else if (s_AAx)
else if (AA.x)
{
RESOLVE_32BIT(16Z, u16, u32, 16A2, 16, 8, (u16), Frame, 1, 0);
}
@ -3174,11 +3174,11 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo
case PSMT16SZ:
if (s_AAy)
if (AA.y)
{
RESOLVE_32BIT(16SZ, u16, u32, 16A4, 16, 8, (u16), Frame, s_AAx, s_AAy);
RESOLVE_32BIT(16SZ, u16, u32, 16A4, 16, 8, (u16), Frame, AA.x, AA.y);
}
else if (s_AAx)
else if (AA.x)
{
RESOLVE_32BIT(16SZ, u16, u32, 16A2, 16, 8, (u16), Frame, 1, 0);
}
@ -3199,11 +3199,11 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo
case PSMCT24:
if (s_AAy)
if (AA.y)
{
RESOLVE_32BIT(32, u32, Vector_16F, 32A4, 8, 8, Float16ToARGB, Frame16, 1, 1);
}
else if (s_AAx)
else if (AA.x)
{
RESOLVE_32BIT(32, u32, Vector_16F, 32A2, 8, 8, Float16ToARGB, Frame16, 1, 0);
}
@ -3216,11 +3216,11 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo
case PSMCT16:
if (s_AAy)
if (AA.y)
{
RESOLVE_32BIT(16, u16, Vector_16F, 16A4, 16, 8, Float16ToARGB16, Frame16, 1, 1);
}
else if (s_AAx)
else if (AA.x)
{
RESOLVE_32BIT(16, u16, Vector_16F, 16A2, 16, 8, Float16ToARGB16, Frame16, 1, 0);
}
@ -3233,11 +3233,11 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo
case PSMCT16S:
if (s_AAy)
if (AA.y)
{
RESOLVE_32BIT(16S, u16, Vector_16F, 16A4, 16, 8, Float16ToARGB16, Frame16, 1, 1);
}
else if (s_AAx)
else if (AA.x)
{
RESOLVE_32BIT(16S, u16, Vector_16F, 16A2, 16, 8, Float16ToARGB16, Frame16, 1, 0);
}
@ -3252,11 +3252,11 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo
case PSMT24Z:
if (s_AAy)
if (AA.y)
{
RESOLVE_32BIT(32Z, u32, Vector_16F, 32ZA4, 8, 8, Float16ToARGB_Z, Frame16, 1, 1);
}
else if (s_AAx)
else if (AA.x)
{
RESOLVE_32BIT(32Z, u32, Vector_16F, 32ZA2, 8, 8, Float16ToARGB_Z, Frame16, 1, 0);
}
@ -3269,11 +3269,11 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo
case PSMT16Z:
if (s_AAy)
if (AA.y)
{
RESOLVE_32BIT(16Z, u16, Vector_16F, 16ZA4, 16, 8, Float16ToARGB16_Z, Frame16, 1, 1);
}
else if (s_AAx)
else if (AA.x)
{
RESOLVE_32BIT(16Z, u16, Vector_16F, 16ZA2, 16, 8, Float16ToARGB16_Z, Frame16, 1, 0);
}
@ -3286,11 +3286,11 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo
case PSMT16SZ:
if (s_AAy)
if (AA.y)
{
RESOLVE_32BIT(16SZ, u16, Vector_16F, 16ZA4, 16, 8, Float16ToARGB16_Z, Frame16, 1, 1);
}
else if (s_AAx)
else if (AA.x)
{
RESOLVE_32BIT(16SZ, u16, Vector_16F, 16ZA2, 16, 8, Float16ToARGB16_Z, Frame16, 1, 0);
}

View File

@ -199,18 +199,19 @@ extern CRenderTargetMngr s_RTs, s_DepthRTs;
extern CBitwiseTextureMngr s_BitwiseTextures;
extern CMemoryTargetMngr g_MemTargs;
extern u8 s_AAx, s_AAy;
//extern u8 s_AAx, s_AAy;
extern Point AA;
// Real rendered width, depends on AA and AAneg.
// Real rendered width, depends on AA.
inline int RW(int tbw)
{
return (tbw << s_AAx);
return (tbw << AA.x);
}
// Real rendered height, depends on AA and AAneg.
// Real rendered height, depends on AA.
inline int RH(int tbh)
{
return (tbh << s_AAy);
return (tbh << AA.y);
}
/* inline void CreateTargetsList(int start, int end, list<ZeroGS::CRenderTarget*>& listTargs) {

View File

@ -415,14 +415,14 @@ void ZeroGS::SetAA(int mode)
s_DepthRTs.ResolveAll();
s_DepthRTs.Destroy();
s_AAx = s_AAy = 0; // This is code for x0, x2, x4, x8 and x16 anti-aliasing.
AA.x = AA.y = 0; // This is code for x0, x2, x4, x8 and x16 anti-aliasing.
if (mode > 0)
{
// ( 1, 0 ) ; ( 1, 1 ) ; ( 2, 1 ) ; ( 2, 2 )
// it's used as a binary shift, so x >> s_AAx, y >> s_AAy
s_AAx = (mode + 1) / 2;
s_AAy = mode / 2;
// it's used as a binary shift, so x >> AA.x, y >> AA.y
AA.x = (mode + 1) / 2;
AA.y = mode / 2;
f = 2.0f;
}
@ -485,8 +485,7 @@ void ZeroGS::RenderCustom(float fAlpha)
DisableAllgl() ;
SetShaderCaller("RenderCustom");
//glViewport(0, 0, nBackbufferWidth, nBackbufferHeight);
glViewport(0, 0, conf.width, conf.height);
glViewport(0, 0, nBackbufferWidth, nBackbufferHeight);
// play custom animation
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
@ -612,7 +611,7 @@ void ZeroGS::KickPoint()
curvb.NotifyWrite(1);
int last = (gs.primIndex + 2) % ARRAY_SIZE(gs.gsvertex);
int last = gs.primNext(2);
VertexGPU* p = curvb.pBufferData + curvb.nCount;
SET_VERTEX(&p[0], last, curvb);
@ -637,8 +636,8 @@ void ZeroGS::KickLine()
curvb.NotifyWrite(2);
int next = (gs.primIndex + 1) % ARRAY_SIZE(gs.gsvertex);
int last = (gs.primIndex + 2) % ARRAY_SIZE(gs.gsvertex);
int next = gs.primNext();
int last = gs.primNext(2);
VertexGPU* p = curvb.pBufferData + curvb.nCount;
SET_VERTEX(&p[0], next, curvb);
@ -703,7 +702,7 @@ void ZeroGS::KickTriangleFan()
// add 1 to skip the first vertex
if (gs.primIndex == gs.nTriFanVert) gs.primIndex = (gs.primIndex + 1) % ARRAY_SIZE(gs.gsvertex);
if (gs.primIndex == gs.nTriFanVert) gs.primIndex = gs.primNext();
OUTPUT_VERT(p[0], 0);
OUTPUT_VERT(p[1], 1);
@ -732,13 +731,12 @@ void ZeroGS::KickSprite()
}
curvb.NotifyWrite(6);
int next = (gs.primIndex + 1) % ARRAY_SIZE(gs.gsvertex);
int last = (gs.primIndex + 2) % ARRAY_SIZE(gs.gsvertex);
int next = gs.primNext();
int last = gs.primNext(2);
// sprite is too small and AA shows lines (tek4, Mana Khemia)
gs.gsvertex[last].x += (4*s_AAx);
gs.gsvertex[last].y += (4*s_AAy);
gs.gsvertex[last].x += (4 * AA.x);
gs.gsvertex[last].y += (4 * AA.y);
// might be bad sprite (KH dialog text)
//if( gs.gsvertex[next].x == gs.gsvertex[last].x || gs.gsvertex[next].y == gs.gsvertex[last].y )