This commit is contained in:
gabest
2008-07-27 20:28:31 +00:00
parent b8c9d459a5
commit dc8cabbb66
25 changed files with 827 additions and 1141 deletions

View File

@@ -25,4 +25,8 @@
SubSystem="2"
RandomizedBaseAddress="1"
/>
<Tool
Name="VCPreBuildEventTool"
CommandLine="SubWCRev.exe $(ProjectDir) $(SolutionDir)svnrev_template.h $(ProjectDir)svnrev.h"
/>
</VisualStudioPropertySheet>

View File

@@ -989,7 +989,7 @@ REG128_SET(GIFPackedReg)
GIFPackedNOP NOP;
REG_SET_END
struct GIFPath
__declspec(align(16)) struct GIFPath
{
GIFTag tag;
UINT32 nreg;

View File

@@ -25,15 +25,15 @@
GSClut::GSClut()
{
BYTE* p = (BYTE*)_aligned_malloc(256 * 2 * sizeof(WORD) * 2 + 256 * sizeof(DWORD) + 256 * sizeof(UINT64), 16);
BYTE* p = (BYTE*)_aligned_malloc(8192, 16);
m_clut = (WORD*)&p[0];
m_buff32 = (DWORD*)&p[1024];
m_buff64 = (UINT64*)&p[2048 + 1024];
m_clut = (WORD*)&p[0]; // 1k + 1k for buffer overruns (sfex: PSM == PSM_PSMT8, CPSM == PSM_PSMCT32, CSA != 0)
m_buff32 = (DWORD*)&p[2048]; // 1k
m_buff64 = (UINT64*)&p[4096]; // 2k
m_write.dirty = true;
m_read.dirty = true;
for(int i = 0; i < 64; i++)
for(int i = 0; i < 16; i++)
{
for(int j = 0; j < 64; j++)
{
@@ -110,8 +110,8 @@ bool GSClut::IsWriting(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT)
case 3: break;
case 4: if(m_CBP[0] == TEX0.CBP) return false; break;
case 5: if(m_CBP[1] == TEX0.CBP) return false; break;
case 6: return false;
case 7: return false;
case 6: ASSERT(0); return false;
case 7: ASSERT(0); return false;
default: __assume(0);
}
@@ -126,10 +126,10 @@ bool GSClut::Write(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT, const G
case 1: break;
case 2: m_CBP[0] = TEX0.CBP; break;
case 3: m_CBP[1] = TEX0.CBP; break;
case 4: if(m_CBP[0] == TEX0.CBP) return false;
case 5: if(m_CBP[1] == TEX0.CBP) return false;
case 6: return false;
case 7: return false;
case 4: if(m_CBP[0] == TEX0.CBP) return false; break;
case 5: if(m_CBP[1] == TEX0.CBP) return false; break;
case 6: ASSERT(0); return false;
case 7: ASSERT(0); return false;
default: __assume(0);
}
@@ -150,21 +150,29 @@ bool GSClut::Write(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT, const G
void GSClut::WriteCLUT32_I8_CSM1(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT, const GSLocalMemory* mem)
{
ASSERT(TEX0.CSA == 0);
WriteCLUT_T32_I8_CSM1(&mem->m_vm32[mem->BlockAddress32(0, 0, TEX0.CBP, 1)], m_clut + (TEX0.CSA << 4));
}
void GSClut::WriteCLUT32_I4_CSM1(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT, const GSLocalMemory* mem)
{
ASSERT(TEX0.CSA < 16);
WriteCLUT_T32_I4_CSM1(&mem->m_vm32[mem->BlockAddress32(0, 0, TEX0.CBP, 1)], m_clut + (TEX0.CSA << 4));
}
void GSClut::WriteCLUT16_I8_CSM1(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT, const GSLocalMemory* mem)
{
ASSERT(TEX0.CSA < 16);
WriteCLUT_T16_I8_CSM1(&mem->m_vm16[mem->BlockAddress16(0, 0, TEX0.CBP, 1)], m_clut + (TEX0.CSA << 4));
}
void GSClut::WriteCLUT16_I4_CSM1(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT, const GSLocalMemory* mem)
{
ASSERT(TEX0.CSA < 32);
WriteCLUT_T16_I4_CSM1(&mem->m_vm16[mem->BlockAddress16(0, 0, TEX0.CBP, 1)], m_clut + (TEX0.CSA << 4));
}

View File

@@ -50,7 +50,7 @@ class GSClut
typedef void (GSClut::*writeCLUT)(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT, const GSLocalMemory* mem);
writeCLUT m_wc[2][64][64];
writeCLUT m_wc[2][16][64];
void WriteCLUT32_I8_CSM1(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT, const GSLocalMemory* mem);
void WriteCLUT32_I4_CSM1(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT, const GSLocalMemory* mem);

View File

@@ -59,6 +59,7 @@ CRC::Game CRC::m_games[] =
{0x086273D2, MetalGearSolid3, FR, false},
{0x26A6E286, MetalGearSolid3, EU, false},
{0xAA31B5BF, MetalGearSolid3, Unknown, false},
{0x9F185CE1, MetalGearSolid3, Unknown, false},
{0x278722BF, DBZBT2, US, false},
{0xFE961D28, DBZBT2, US, false},
{0X0393B6BE, DBZBT2, EU, false},
@@ -97,6 +98,7 @@ CRC::Game CRC::m_games[] =
{0xf0a6d880, HarvestMoon, US, true},
{0x75c01a04, NamcoXCapcom, US, false},
{0xBF6F101F, GiTS, US, false},
{0x6BF11378, Onimusha3, US, false},
};
CAtlMap<DWORD, CRC::Game*> CRC::m_map;

View File

@@ -59,7 +59,9 @@ public:
JackieChanAdv,
HarvestMoon,
NamcoXCapcom,
GiTS
GiTS,
Onimusha3,
TitleCount
};
enum Region

View File

@@ -38,6 +38,7 @@ GSDump::~GSDump()
void GSDump::Open(LPCTSTR fn, DWORD crc, const freezeData& fd, const void* regs)
{
m_fp = _tfopen(fn, _T("wb"));
m_vsyncs = 0;
if(m_fp)
{
@@ -78,7 +79,7 @@ void GSDump::VSync(int field, bool last, const void* regs)
fputc(1, m_fp);
fputc(field, m_fp);
if(!field && last)
if((++m_vsyncs & 1) == 0 && last)
{
fclose(m_fp);
m_fp = NULL;

View File

@@ -45,6 +45,7 @@ Regs data (id == 3)
class GSDump
{
FILE* m_fp;
int m_vsyncs;
public:
GSDump();

View File

@@ -870,16 +870,13 @@ public:
}
}
__forceinline GSVector4i ReadFrameX(int PSM, const GSVector4i& addr) const
__forceinline GSVector4i ReadFrameX(int psm, const GSVector4i& addr) const
{
GSVector4i c, r, g, b, a;
// TODO
switch(PSM)
switch(psm)
{
case PSM_PSMCT32:
case PSM_PSMZ32:
case 0:
#if _M_SSE >= 0x401
c = addr.gather32_32(m_vm32);
#else
@@ -890,8 +887,7 @@ public:
(int)ReadPixel32(addr.u32[3]));
#endif
break;
case PSM_PSMCT24:
case PSM_PSMZ24:
case 1:
#if _M_SSE >= 0x401
c = addr.gather32_32(m_vm32);
#else
@@ -903,10 +899,7 @@ public:
#endif
c = (c & 0x00ffffff) | 0x80000000;
break;
case PSM_PSMCT16:
case PSM_PSMCT16S:
case PSM_PSMZ16:
case PSM_PSMZ16S:
case 2:
#if _M_SSE >= 0x401
c = addr.gather32_32(m_vm16);
#else
@@ -926,13 +919,13 @@ public:
return c;
}
__forceinline GSVector4i ReadZBufX(int PSM, const GSVector4i& addr) const
__forceinline GSVector4i ReadZBufX(int psm, const GSVector4i& addr) const
{
GSVector4i z;
switch(PSM)
switch(psm)
{
case PSM_PSMZ32:
case 0:
#if _M_SSE >= 0x401
z = addr.gather32_32(m_vm32);
#else
@@ -943,7 +936,7 @@ public:
(int)ReadPixel32(addr.u32[3]));
#endif
break;
case PSM_PSMZ24:
case 1:
#if _M_SSE >= 0x401
z = addr.gather32_32(m_vm32) & 0x00ffffff;
#else
@@ -955,8 +948,7 @@ public:
z = z & 0x00ffffff;
#endif
break;
case PSM_PSMZ16:
case PSM_PSMZ16S:
case 2:
#if _M_SSE >= 0x401
z = addr.gather32_32(m_vm16);
#else
@@ -975,28 +967,23 @@ public:
return z;
}
__forceinline void WriteFrameX(int PSM, const GSVector4i& addr, const GSVector4i& c, const GSVector4i& mask, int pixels)
__forceinline void WriteFrameX(int psm, const GSVector4i& addr, const GSVector4i& c, const GSVector4i& mask, int pixels)
{
GSVector4i rb, ga, tmp;
switch(PSM)
switch(psm)
{
case PSM_PSMCT32:
case PSM_PSMZ32:
case 0:
for(int i = 0; i < pixels; i++)
if(mask.u32[i] != 0xffffffff)
WritePixel32(addr.u32[i], c.u32[i]);
break;
case PSM_PSMCT24:
case PSM_PSMZ24:
case 1:
for(int i = 0; i < pixels; i++)
if(mask.u32[i] != 0xffffffff)
WritePixel24(addr.u32[i], c.u32[i]);
break;
case PSM_PSMCT16:
case PSM_PSMCT16S:
case PSM_PSMZ16:
case PSM_PSMZ16S:
case 2:
rb = c & 0x00f800f8;
ga = c & 0x8000f800;
tmp = (ga >> 16) | (rb >> 9) | (ga >> 6) | (rb >> 3);
@@ -1010,22 +997,21 @@ public:
}
}
__forceinline void WriteZBufX(int PSM, const GSVector4i& addr, const GSVector4i& z, const GSVector4i& mask, int pixels)
__forceinline void WriteZBufX(int psm, const GSVector4i& addr, const GSVector4i& z, const GSVector4i& mask, int pixels)
{
switch(PSM)
switch(psm)
{
case PSM_PSMZ32:
case 0:
for(int i = 0; i < pixels; i++)
if(mask.u32[i] != 0xffffffff)
WritePixel32(addr.u32[i], z.u32[i]);
break;
case PSM_PSMZ24:
case 1:
for(int i = 0; i < pixels; i++)
if(mask.u32[i] != 0xffffffff)
WritePixel24(addr.u32[i], z.u32[i]);
break;
case PSM_PSMZ16:
case PSM_PSMZ16S:
case 2:
for(int i = 0; i < pixels; i++)
if(mask.u32[i] != 0xffffffff)
WritePixel16(addr.u32[i], z.u32[i]);

View File

@@ -60,17 +60,11 @@ GSRasterizer::GSRasterizer(GSState* state, int id, int threads)
InitDS_ZPSM(iFPSM, 0) \
InitDS_ZPSM(iFPSM, 1) \
InitDS_ZPSM(iFPSM, 2) \
InitDS_ZPSM(iFPSM, 3) \
#define InitDS() \
InitDS_FPSM(0) \
InitDS_FPSM(1) \
InitDS_FPSM(2) \
InitDS_FPSM(3) \
InitDS_FPSM(4) \
InitDS_FPSM(5) \
InitDS_FPSM(6) \
InitDS_FPSM(7) \
InitDS();
@@ -125,8 +119,8 @@ int GSRasterizer::Draw(Vertex* vertices, int count)
m_sel.dw = 0;
m_sel.fpsm = GSUtil::EncodeFPSM(context->FRAME.PSM);
m_sel.zpsm = GSUtil::EncodeZPSM(context->ZBUF.PSM);
m_sel.fpsm = GSUtil::EncodePSM(context->FRAME.PSM);
m_sel.zpsm = GSUtil::EncodePSM(context->ZBUF.PSM);
m_sel.ztst = context->TEST.ZTE && context->TEST.ZTST > 1 ? context->TEST.ZTST : context->ZBUF.ZMSK ? 0 : 1;
m_sel.iip = PRIM->PRIM == GS_POINTLIST || PRIM->PRIM == GS_SPRITE ? 0 : PRIM->IIP;
m_sel.tfx = PRIM->TME ? context->TEX0.TFX : 4;
@@ -154,22 +148,19 @@ int GSRasterizer::Draw(Vertex* vertices, int count)
}
m_sel.atst = context->TEST.ATE ? context->TEST.ATST : 1;
m_sel.afail = context->TEST.AFAIL;
m_sel.afail = context->TEST.ATE ? context->TEST.AFAIL : 0;
m_sel.fge = PRIM->FGE;
m_sel.rfb =
PRIM->ABE || env.PABE.PABE || context->TEST.DATE ||
context->FRAME.FBMSK != 0 && context->FRAME.FBMSK != 0xffffffff ||
context->TEST.ATE && context->TEST.ATST != 1 && context->TEST.AFAIL == 3;
m_sel.date = context->FRAME.PSM != PSM_PSMCT24 ? context->TEST.DATE : 0;
m_sel.abe = env.PABE.PABE ? 2 : PRIM->ABE ? 1 : 0;
m_sel.abea = m_sel.abe ? context->ALPHA.A : 0;
m_sel.abeb = m_sel.abe ? context->ALPHA.B : 0;
m_sel.abec = m_sel.abe ? context->ALPHA.C : 0;
m_sel.abed = m_sel.abe ? context->ALPHA.D : 0;
m_sel.rfb = m_sel.date || m_sel.abe || m_sel.atst != 1 && m_sel.afail == 3 || context->FRAME.FBMSK != 0 && context->FRAME.FBMSK != 0xffffffff;
m_dsf = m_ds[m_sel.fpsm][m_sel.zpsm][m_sel.ztst][m_sel.iip];
CAtlMap<DWORD, DrawScanlinePtr>::CPair* pair = m_dsmap2.Lookup(m_sel);
CRBMap<DWORD, DrawScanlinePtr>::CPair* pair = m_dsmap2.Lookup(m_sel);
if(pair)
{
@@ -183,7 +174,7 @@ int GSRasterizer::Draw(Vertex* vertices, int count)
{
m_dsf = pair->m_value;
m_dsmap2[pair->m_key] = pair->m_value;
m_dsmap2.SetAt(pair->m_key, pair->m_value);
}
else if(!pair)
{
@@ -193,11 +184,11 @@ int GSRasterizer::Draw(Vertex* vertices, int count)
m_sel.tfx, m_sel.tcc, m_sel.fst, m_sel.ltf,
m_sel.atst, m_sel.afail, m_sel.fge, m_sel.rfb, m_sel.date, m_sel.abe);
m_dsmap[m_sel] = NULL;
m_dsmap.SetAt(m_sel, NULL);
if(FILE* fp = _tfopen(_T("c:\\1.txt"), _T("w")))
{
POSITION pos = m_dsmap.GetStartPosition();
POSITION pos = m_dsmap.GetHeadPosition();
while(pos)
{
@@ -205,7 +196,7 @@ int GSRasterizer::Draw(Vertex* vertices, int count)
if(!pair->m_value)
{
_ftprintf(fp, _T("m_dsmap[0x%08x] = &GSRasterizer::DrawScanlineEx<0x%08x>;\n"), pair->m_key, pair->m_key);
_ftprintf(fp, _T("m_dsmap.SetAt(0x%08x, &GSRasterizer::DrawScanlineEx<0x%08x>);\n"), pair->m_key, pair->m_key);
}
}
@@ -828,25 +819,9 @@ void GSRasterizer::SetupScanline(const Vertex& dv)
}
}
template<int iFPSM, int iZPSM, int ztst, int iip>
template<DWORD fpsm, DWORD zpsm, DWORD ztst, DWORD iip>
void GSRasterizer::DrawScanline(int top, int left, int right, const Vertex& v)
{
/*
extern UINT64 g_slp1;
extern UINT64 g_slp2;
extern UINT64 g_slp3;
extern UINT64 g_slp4;
{
int steps = right - left;
for(; steps >= 4; steps -= 4) g_slp4++;
if(steps == 1) g_slp1++;
else if(steps == 2) g_slp2++;
else if(steps == 3) g_slp3++;
}
*/
int fpsm = GSUtil::DecodeFPSM(iFPSM);
int zpsm = GSUtil::DecodeZPSM(iZPSM);
GSVector4i fa_base = m_slenv.fbco[top];
GSVector4i* fa_offset = (GSVector4i*)&m_slenv.fo[left];
@@ -887,18 +862,24 @@ else if(steps == 3) g_slp3++;
GSVector4i test = GSVector4i::zero();
GSVector4i zs = (GSVector4i(z * 0.5f) << 1) | (GSVector4i(z) & GSVector4i::one());
GSVector4i zd;
if(ztst > 1)
{
zd = m_state->m_mem.ReadZBufX(zpsm, za);
GSVector4i zd = m_state->m_mem.ReadZBufX(zpsm, za);
GSVector4i offset = GSVector4i::x80000000();
GSVector4i zso = zs;
GSVector4i zdo = zd;
if(zpsm == 0)
{
zso = zs - GSVector4i::x80000000();
zdo = zd - GSVector4i::x80000000();
}
switch(ztst)
{
case 2: test = (zs - offset) < (zd - offset); break; // ge
case 3: test = (zs - offset) <= (zd - offset); break; // g
case 2: test = zso < zdo; break; // ge
case 3: test = zso <= zdo; break; // g
default: __assume(0);
}
@@ -1099,10 +1080,10 @@ else if(steps == 3) g_slp3++;
c[10] = GSVector4::zero();
c[11] = m_slenv.afix;
int abea = m_sel.abea;
int abeb = m_sel.abeb;
int abec = m_sel.abec;
int abed = m_sel.abed;
DWORD abea = m_sel.abea;
DWORD abeb = m_sel.abeb;
DWORD abec = m_sel.abec;
DWORD abed = m_sel.abed;
GSVector4 r = (c[abea*4 + 0] - c[abeb*4 + 0]).mod2x(c[abec*4 + 3]) + c[abed*4 + 0];
GSVector4 g = (c[abea*4 + 1] - c[abeb*4 + 1]).mod2x(c[abec*4 + 3]) + c[abed*4 + 1];

View File

@@ -86,29 +86,29 @@ private:
{
struct
{
DWORD fpsm:3; // 0
DWORD zpsm:2; // 3
DWORD ztst:2; // 5 (0: off, 1: write, 2: write + test (ge), 3: write + test (g))
DWORD iip:1; // 7
DWORD tfx:3; // 8
DWORD tcc:1; // 11
DWORD fst:1; // 12
DWORD ltf:1; // 13
DWORD atst:3; // 14
DWORD afail:2; // 17
DWORD fge:1; // 19
DWORD rfb:1; // 20
DWORD date:1; // 21
DWORD abe:2; // 22
DWORD abea:2; // 24
DWORD abeb:2; // 26
DWORD abec:2; // 28
DWORD abed:2; // 30
DWORD fpsm:2; // 0
DWORD zpsm:2; // 2
DWORD ztst:2; // 4 (0: off, 1: write, 2: write + test (ge), 3: write + test (g))
DWORD iip:1; // 6
DWORD tfx:3; // 7
DWORD tcc:1; // 10
DWORD fst:1; // 11
DWORD ltf:1; // 12
DWORD atst:3; // 13
DWORD afail:2; // 16
DWORD fge:1; // 18
DWORD date:1; // 19
DWORD abe:2; // 20
DWORD abea:2; // 22
DWORD abeb:2; // 24
DWORD abec:2; // 26
DWORD abed:2; // 28
DWORD rfb:1; // 30
};
DWORD dw;
operator DWORD() {return dw & 0xffffffff;}
operator DWORD() {return dw & 0x7fffffff;}
};
CRect m_scissor;
@@ -137,10 +137,10 @@ private:
typedef void (GSRasterizer::*DrawScanlinePtr)(int top, int left, int right, const Vertex& v);
DrawScanlinePtr m_ds[8][4][4][2], m_dsf;
CAtlMap<DWORD, DrawScanlinePtr> m_dsmap, m_dsmap2;
DrawScanlinePtr m_ds[4][4][4][2], m_dsf;
CRBMap<DWORD, DrawScanlinePtr> m_dsmap, m_dsmap2;
template<int iFPSM, int iZPSM, int iZTST, int iIIP>
template<DWORD fpsm, DWORD zpsm, DWORD ztst, DWORD iip>
void DrawScanline(int top, int left, int right, const Vertex& v);
void InitEx();

File diff suppressed because it is too large Load Diff

View File

@@ -441,7 +441,7 @@ public:
fn.Format(_T("%s_%s"), path, CTime::GetCurrentTime().Format(_T("%Y%m%d%H%M%S")));
if((::GetAsyncKeyState(VK_SHIFT) & 0x8000) && !m_dump && m_field == 0)
if((::GetAsyncKeyState(VK_SHIFT) & 0x8000) && !m_dump)
{
freezeData fd;
fd.size = 0;

View File

@@ -34,6 +34,19 @@ GSRendererHW10::GSRendererHW10(BYTE* base, bool mt, void (*irq)(), int nloophack
{
m_fpDrawingKickHandlers[i] = (DrawingKickHandler)&GSRendererHW10::DrawingKick;
}
m_fpDrawingKickHandlers[GS_POINTLIST] = (DrawingKickHandler)&GSRendererHW10::DrawingKickPoint;
#if _M_SSE >= 0x401
m_fpDrawingKickHandlers[GS_LINELIST] = (DrawingKickHandler)&GSRendererHW10::DrawingKickLine;
m_fpDrawingKickHandlers[GS_LINESTRIP] = (DrawingKickHandler)&GSRendererHW10::DrawingKickLine;
m_fpDrawingKickHandlers[GS_TRIANGLELIST] = (DrawingKickHandler)&GSRendererHW10::DrawingKickTriangle;
m_fpDrawingKickHandlers[GS_TRIANGLESTRIP] = (DrawingKickHandler)&GSRendererHW10::DrawingKickTriangle;
m_fpDrawingKickHandlers[GS_TRIANGLEFAN] = (DrawingKickHandler)&GSRendererHW10::DrawingKickTriangle;
m_fpDrawingKickHandlers[GS_SPRITE] = (DrawingKickHandler)&GSRendererHW10::DrawingKickSprite;
#endif
}
bool GSRendererHW10::Create(LPCTSTR title)
@@ -120,10 +133,82 @@ void GSRendererHW10::VertexKick(bool skip)
__super::VertexKick(skip);
}
int GSRendererHW10::ScissorTest(const GSVector4i& p0, const GSVector4i& p1)
{
GSVector4i scissor = m_context->scissor.dx10;
GSVector4i v0 = p0 < scissor;
GSVector4i v1 = p1 > scissor.zwxy();
return (v0 | v1).mask() & 0xff;
}
void GSRendererHW10::DrawingKickPoint(GSVertexHW10* v, int& count)
{
GSVector4i v0 = GSVector4i::load((int)v[0].p.xy).upl16();
GSVector4i p0 = v0;
GSVector4i p1 = v0;
if(ScissorTest(p0, p1))
{
count = 0;
return;
}
}
#if _M_SSE >= 0x401
void GSRendererHW10::DrawingKickLine(GSVertexHW10* v, int& count)
{
GSVector4i v0 = GSVector4i::load((int)v[0].p.xy);
GSVector4i v1 = GSVector4i::load((int)v[1].p.xy);
GSVector4i p0 = v0.max_u16(v1).upl16();
GSVector4i p1 = v0.min_u16(v1).upl16();
if(ScissorTest(p0, p1))
{
count = 0;
return;
}
}
void GSRendererHW10::DrawingKickTriangle(GSVertexHW10* v, int& count)
{
GSVector4i v0 = GSVector4i::load((int)v[0].p.xy);
GSVector4i v1 = GSVector4i::load((int)v[1].p.xy);
GSVector4i v2 = GSVector4i::load((int)v[2].p.xy);
GSVector4i p0 = v0.max_u16(v1).max_u16(v2).upl16();
GSVector4i p1 = v0.min_u16(v1).min_u16(v2).upl16();
if(ScissorTest(p0, p1))
{
count = 0;
return;
}
}
void GSRendererHW10::DrawingKickSprite(GSVertexHW10* v, int& count)
{
GSVector4i v0 = GSVector4i::load((int)v[0].p.xy);
GSVector4i v1 = GSVector4i::load((int)v[1].p.xy);
GSVector4i p0 = v0.max_u16(v1).upl16();
GSVector4i p1 = v0.min_u16(v1).upl16();
if(ScissorTest(p0, p1))
{
count = 0;
return;
}
}
#endif
void GSRendererHW10::DrawingKick(GSVertexHW10* v, int& count)
{
// TODO
GSVector4i scissor = m_context->scissor.dx10;
switch(count)

View File

@@ -35,6 +35,18 @@ protected:
void Draw();
bool WrapZ(DWORD maxz);
__forceinline int ScissorTest(const GSVector4i& p0, const GSVector4i& p1);
void DrawingKickPoint(GSVertexHW10* v, int& count);
#if _M_SSE >= 0x401
void DrawingKickLine(GSVertexHW10* v, int& count);
void DrawingKickTriangle(GSVertexHW10* v, int& count);
void DrawingKickSprite(GSVertexHW10* v, int& count);
#endif
struct
{
CComPtr<ID3D10DepthStencilState> dss;

View File

@@ -115,8 +115,6 @@ GSState::GSState(BYTE* base, bool mt, void (*irq)(), int nloophack)
m_maxbytes = 1024 * 1024 * 4;
m_buff = (BYTE*)_aligned_malloc(m_maxbytes, 16);
m_path = (GIFPath*)_aligned_malloc(sizeof(m_path[0]) * 3, 16);
Reset();
ResetHandlers();
@@ -125,7 +123,6 @@ GSState::GSState(BYTE* base, bool mt, void (*irq)(), int nloophack)
GSState::~GSState()
{
_aligned_free(m_buff);
_aligned_free(m_path);
}
void GSState::Reset()
@@ -597,23 +594,19 @@ template<int i> void GSState::GIFRegHandlerTEX0(GIFReg* r)
m_env.CTXT[i].TEX0 = r->TEX0;
// ASSERT(m_env.CTXT[i].TEX0.TW <= 10 && m_env.CTXT[i].TEX0.TH <= 10 && (m_env.CTXT[i].TEX0.CPSM & ~0xa) == 0);
if(m_env.CTXT[i].TEX0.TW > 10) m_env.CTXT[i].TEX0.TW = 10;
if(m_env.CTXT[i].TEX0.TH > 10) m_env.CTXT[i].TEX0.TH = 10;
m_env.CTXT[i].TEX0.CPSM &= 0xa; // 1010b
m_env.CTXT[i].ttbl = &GSLocalMemory::m_psm[m_env.CTXT[i].TEX0.PSM];
FlushWrite();
m_mem.m_clut.Write(r->TEX0, m_env.TEXCLUT, &m_mem);
if((m_env.CTXT[i].TEX0.TBW & 1) && (m_env.CTXT[i].TEX0.PSM == PSM_PSMT8 || m_env.CTXT[i].TEX0.PSM == PSM_PSMT4))
{
m_env.CTXT[i].TEX0.TBW &= ~1;
m_env.CTXT[i].TEX0.TBW &= ~1; // GS User 2.6
}
m_env.CTXT[i].ttbl = &GSLocalMemory::m_psm[m_env.CTXT[i].TEX0.PSM];
m_mem.m_clut.Write(m_env.CTXT[i].TEX0, m_env.TEXCLUT, &m_mem);
}
template<int i> void GSState::GIFRegHandlerCLAMP(GIFReg* r)
@@ -1257,7 +1250,7 @@ template<int index> void GSState::Transfer(BYTE* mem, UINT32 size)
if(path.tag.PRE)
{
ASSERT(path.tag.FLG != GIF_FLG_IMAGE); // kingdom hearts
ASSERT(path.tag.FLG != GIF_FLG_IMAGE); // kingdom hearts, ffxii
if((path.tag.FLG & 2) == 0)
{
@@ -2092,6 +2085,24 @@ bool GSC_GiTS(const GSFrameInfo& fi, int& skip)
return true;
}
bool GSC_Onimusha3(const GSFrameInfo& fi, int& skip)
{
if(skip == 0)
{
if(fi.TME && (fi.FBP == 0x00e00 && fi.TBP0 == 0x00700 /*|| fi.FBP == 0x01000 && fi.TBP0 == 0x00e00*/))
{
// skip = 1000;
}
}
if(fi.TME && (fi.FBP == 0x00700 && fi.TBP0 == 0x00e00 /*|| fi.FBP == 0x00e00 && fi.TBP0 == 0x01000*/))
{
// skip = 1;
}
return true;
}
bool GSState::IsBadFrame(int& skip)
{
GSFrameInfo fi;
@@ -2102,10 +2113,15 @@ bool GSState::IsBadFrame(int& skip)
fi.TBP0 = m_context->TEX0.TBP0;
fi.TPSM = m_context->TEX0.PSM;
static CAtlMap<CRC::Title, GetSkipCount> map;
static GetSkipCount map[CRC::TitleCount];
static bool inited = false;
if(map.IsEmpty())
if(!inited)
{
inited = true;
memset(map, 0, sizeof(map));
map[CRC::Okami] = GSC_Okami;
map[CRC::MetalGearSolid3] = GSC_MetalGearSolid3;
map[CRC::DBZBT2] = GSC_DBZBT2;
@@ -2129,14 +2145,14 @@ bool GSState::IsBadFrame(int& skip)
map[CRC::GodOfWar] = GSC_GodOfWar;
map[CRC::GodOfWar2] = GSC_GodOfWar;
map[CRC::GiTS] = GSC_GiTS;
map[CRC::Onimusha3] = GSC_Onimusha3;
}
if(CAtlMap<CRC::Title, GetSkipCount>::CPair* pair = map.Lookup(m_game.title))
GetSkipCount gsc = map[m_game.title];
if(gsc && !gsc(fi, skip))
{
if(!pair->m_value(fi, skip))
{
return false;
}
return false;
}
if(skip == 0)

View File

@@ -141,7 +141,7 @@ public:
GSRegBUSDIR* BUSDIR;
GSRegSIGLBLID* SIGLBLID;
GIFPath* m_path;
GIFPath m_path[3];
GSLocalMemory m_mem;
GSDrawingEnvironment m_env;
GSDrawingContext* m_context;

View File

@@ -107,12 +107,12 @@ public:
class GSTexture : public GSSurface
{
protected:
bool GetDirtyRect(CRect& r)
bool GetDirtyRect(CRect& rr)
{
int w = 1 << m_TEX0.TW;
int h = 1 << m_TEX0.TH;
r = CRect(0, 0, w, h);
CRect r(0, 0, w, h);
POSITION pos = m_dirty.GetHeadPosition();
@@ -172,7 +172,14 @@ public:
r |= m_valid;
}
return !r.IsRectEmpty();
if(r.IsRectEmpty())
{
return false;
}
rr = r;
return true;
}
public:

View File

@@ -67,65 +67,24 @@ public:
static bool IsRectInRectH(const CRect& inner, const CRect& outer);
static bool IsRectInRectV(const CRect& inner, const CRect& outer);
static int EncodeFPSM(int psm)
static int EncodePSM(int psm)
{
switch(psm)
{
case PSM_PSMCT32: return 0;
case PSM_PSMCT24: return 1;
case PSM_PSMCT16: return 2;
case PSM_PSMCT16S: return 3;
case PSM_PSMZ32: return 4;
case PSM_PSMZ24: return 5;
case PSM_PSMZ16: return 6;
case PSM_PSMZ16S: return 7;
case PSM_PSMCT32:
case PSM_PSMZ32:
return 0;
case PSM_PSMCT24:
case PSM_PSMZ24:
return 1;
case PSM_PSMCT16:
case PSM_PSMCT16S:
case PSM_PSMZ16:
case PSM_PSMZ16S:
return 2;
default:
return 3;
}
return -1;
}
static int DecodeFPSM(int index)
{
switch(index)
{
case 0: return PSM_PSMCT32;
case 1: return PSM_PSMCT24;
case 2: return PSM_PSMCT16;
case 3: return PSM_PSMCT16S;
case 4: return PSM_PSMZ32;
case 5: return PSM_PSMZ24;
case 6: return PSM_PSMZ16;
case 7: return PSM_PSMZ16S;
}
return -1;
}
static int EncodeZPSM(int psm)
{
switch(psm)
{
case PSM_PSMZ32: return 0;
case PSM_PSMZ24: return 1;
case PSM_PSMZ16: return 2;
case PSM_PSMZ16S: return 3;
}
return -1;
}
static int DecodeZPSM(int index)
{
switch(index)
{
case 0: return PSM_PSMZ32;
case 1: return PSM_PSMZ24;
case 2: return PSM_PSMZ16;
case 3: return PSM_PSMZ16S;
}
return -1;
}
};

View File

@@ -250,6 +250,78 @@ public:
#endif
#if _M_SSE >= 0x401
GSVector4i min_i8(const GSVector4i& a) const
{
return GSVector4i(_mm_min_epi8(m, a));
}
GSVector4i max_i8(const GSVector4i& a) const
{
return GSVector4i(_mm_max_epi8(m, a));
}
#endif
GSVector4i min_i16(const GSVector4i& a) const
{
return GSVector4i(_mm_min_epi16(m, a));
}
GSVector4i max_i16(const GSVector4i& a) const
{
return GSVector4i(_mm_max_epi16(m, a));
}
#if _M_SSE >= 0x401
GSVector4i min_i32(const GSVector4i& a) const
{
return GSVector4i(_mm_min_epi32(m, a));
}
GSVector4i max_i32(const GSVector4i& a) const
{
return GSVector4i(_mm_max_epi32(m, a));
}
#endif
GSVector4i min_u8(const GSVector4i& a) const
{
return GSVector4i(_mm_min_epu8(m, a));
}
GSVector4i max_u8(const GSVector4i& a) const
{
return GSVector4i(_mm_max_epu8(m, a));
}
#if _M_SSE >= 0x401
GSVector4i min_u16(const GSVector4i& a) const
{
return GSVector4i(_mm_min_epu16(m, a));
}
GSVector4i max_u16(const GSVector4i& a) const
{
return GSVector4i(_mm_max_epu16(m, a));
}
GSVector4i min_u32(const GSVector4i& a) const
{
return GSVector4i(_mm_min_epu32(m, a));
}
GSVector4i max_u32(const GSVector4i& a) const
{
return GSVector4i(_mm_max_epu32(m, a));
}
#endif
GSVector4i blend8(const GSVector4i& a, const GSVector4i& mask) const
{
return GSVector4i(_mm_blendv_epi8(m, a, mask));

View File

@@ -57,7 +57,7 @@ __declspec(align(16)) union GSVertexHW10
union
{
struct {WORD x, y; DWORD z;} p;
struct {union {struct {WORD x, y;}; DWORD xy;}; DWORD z;} p;
GIFRegXYZ XYZ;
};

View File

@@ -26,6 +26,7 @@
#include "GSRendererSW.h"
#include "GSRendererNull.h"
#include "GSSettingsDlg.h"
#include "svnrev.h"
//
// Note!
@@ -139,7 +140,11 @@ EXPORT_C_(UINT32) PS2EgetLibType()
EXPORT_C_(char*) PS2EgetLibName()
{
CString str = _T("GSdx");
CString str;
str.Format(_T("GSdx %d"), SVN_REV);
if(SVN_MODS) str += _T("m");
#if _M_AMD64
str += _T(" 64-bit");

View File

@@ -1781,6 +1781,10 @@
RelativePath=".\stdafx.h"
>
</File>
<File
RelativePath=".\svnrev.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"

2
svnrev_template.h Normal file
View File

@@ -0,0 +1,2 @@
#define SVN_REV $WCREV$
#define SVN_MODS $WCMODS?1:0$

View File

@@ -1202,6 +1202,10 @@
RelativePath=".\stdafx.h"
>
</File>
<File
RelativePath=".\svnrev.h"
>
</File>
<File
RelativePath=".\xpad.h"
>