Add more stuff to GeDisasm. Advance index pointer on indexed draws.

This commit is contained in:
Henrik Rydgård 2012-12-28 20:53:26 +01:00
parent e2cc226d0d
commit 75ce287213
2 changed files with 46 additions and 5 deletions

View file

@ -138,6 +138,9 @@ const int flushBeforeCommandList[] = {
GE_CMD_STENCILTESTENABLE,
GE_CMD_STENCILOP,
GE_CMD_ZTEST,
GE_CMD_FOG1,
GE_CMD_FOG2,
GE_CMD_FOGCOLOR,
GE_CMD_MORPHWEIGHT0,
GE_CMD_MORPHWEIGHT1,
GE_CMD_MORPHWEIGHT2,
@ -492,6 +495,7 @@ void GLES_GPU::ExecuteOp(u32 op, u32 diff) {
ERROR_LOG(G3D, "Bad vertex address %08x!", gstate_c.vertexAddr);
break;
}
// TODO: Split this so that we can collect sequences of primitives, can greatly speed things up
// on platforms where draw calls are expensive like mobile and D3D
void *verts = Memory::GetPointer(gstate_c.vertexAddr);
@ -504,11 +508,19 @@ void GLES_GPU::ExecuteOp(u32 op, u32 diff) {
inds = Memory::GetPointer(gstate_c.indexAddr);
}
// Seems we have to advance the vertex addr, at least in some cases.
// Question: Should we also advance the index addr?
int bytesRead;
transformDraw_.SubmitPrim(verts, inds, type, count, gstate.vertType, 0, -1, &bytesRead);
gstate_c.vertexAddr += bytesRead;
// After drawing, we advance the vertexAddr (when non indexed) or indexAddr (when indexed).
// Some games rely on this, they don't bother reloading VADDR and IADDR.
// Q: Are these changed reflected in the real registers? Needs testing.
if (inds) {
int indexSize = 1;
if ((gstate.vertType & GE_VTYPE_IDX_MASK) == GE_VTYPE_IDX_16BIT)
indexSize = 2;
gstate_c.indexAddr += count * indexSize;
} else {
gstate_c.vertexAddr += bytesRead;
}
}
break;

View file

@ -52,7 +52,7 @@ void GeDisassembleOp(u32 pc, u32 op, u32 prev, char *buffer) {
"TRIANGLE_FAN",
"RECTANGLES",
};
sprintf(buffer, "DrawPrim type: %s count: %i vaddr= %08x, iaddr= %08x", type<7 ? types[type] : "INVALID", count, gstate_c.vertexAddr, gstate_c.indexAddr);
sprintf(buffer, "DrawPrim type: %s count: %i vaddr= %08x, iaddr= %08x", type < 7 ? types[type] : "INVALID", count, gstate_c.vertexAddr, gstate_c.indexAddr);
}
break;
@ -639,9 +639,30 @@ void GeDisassembleOp(u32 pc, u32 op, u32 prev, char *buffer) {
sprintf(buffer, "TexFlush");
break;
case GE_CMD_TEXSYNC:
sprintf(buffer, "TexSync");
break;
case GE_CMD_TEXWRAP:
sprintf(buffer, "TexWrap %08x", data);
break;
case GE_CMD_FOG1:
sprintf(buffer, "Fog1 %f", getFloat24(data));
break;
case GE_CMD_FOG2:
sprintf(buffer, "Fog2 %f", getFloat24(data));
break;
case GE_CMD_FOGCOLOR:
sprintf(buffer, "FogColor %06x", data);
break;
case GE_CMD_TEXLODSLOPE:
sprintf(buffer, "TexLodSlope %06x", data);
break;
//////////////////////////////////////////////////////////////////
// Z/STENCIL TESTING
//////////////////////////////////////////////////////////////////
@ -650,6 +671,14 @@ void GeDisassembleOp(u32 pc, u32 op, u32 prev, char *buffer) {
sprintf(buffer, "Z test enable: %d", data & 1);
break;
case GE_CMD_STENCILOP:
sprintf(buffer, "Stencil op: %06x", data);
break;
case GE_CMD_STENCILTEST:
sprintf(buffer, "Stencil test: %06x", data);
break;
case GE_CMD_STENCILTESTENABLE:
sprintf(buffer, "Stencil test enable: %d", data);
break;
@ -737,7 +766,7 @@ void GeDisassembleOp(u32 pc, u32 op, u32 prev, char *buffer) {
break;
default:
sprintf(buffer, "Unknown: %08x @ %08x", op, pc);
sprintf(buffer, "Unknown: %08x", op);
break;
}
}