mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-24 00:29:57 +00:00
Add GPU cycle estimation to the softgpu.
This commit is contained in:
parent
1e65a691f4
commit
98e257c95d
@ -268,6 +268,32 @@ void SoftGPU::FastRunLoop(DisplayList &list) {
|
||||
}
|
||||
}
|
||||
|
||||
int EstimatePerVertexCost() {
|
||||
// TODO: This is transform cost, also account for rasterization cost somehow... although it probably
|
||||
// runs in parallel with transform.
|
||||
|
||||
// Also, this is all pure guesswork. If we can find a way to do measurements, that would be great.
|
||||
|
||||
// GTA wants a low value to run smooth, GoW wants a high value (otherwise it thinks things
|
||||
// went too fast and starts doing all the work over again).
|
||||
|
||||
int cost = 20;
|
||||
if (gstate.isLightingEnabled()) {
|
||||
cost += 10;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (gstate.isLightChanEnabled(i))
|
||||
cost += 10;
|
||||
}
|
||||
if (gstate.getUVGenMode() != GE_TEXMAP_TEXTURE_COORDS) {
|
||||
cost += 20;
|
||||
}
|
||||
// TODO: morphcount
|
||||
|
||||
return cost;
|
||||
}
|
||||
|
||||
void SoftGPU::ExecuteOp(u32 op, u32 diff)
|
||||
{
|
||||
u32 cmd = op >> 24;
|
||||
@ -303,6 +329,7 @@ void SoftGPU::ExecuteOp(u32 op, u32 diff)
|
||||
|
||||
if (type != GE_PRIM_TRIANGLES && type != GE_PRIM_TRIANGLE_STRIP && type != GE_PRIM_TRIANGLE_FAN && type != GE_PRIM_RECTANGLES) {
|
||||
ERROR_LOG_REPORT(G3D, "Software: DL DrawPrim type: %s count: %i vaddr= %08x, iaddr= %08x", type<7 ? types[type] : "INVALID", count, gstate_c.vertexAddr, gstate_c.indexAddr);
|
||||
cyclesExecuted += EstimatePerVertexCost() * count;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -321,6 +348,7 @@ void SoftGPU::ExecuteOp(u32 op, u32 diff)
|
||||
indices = Memory::GetPointer(gstate_c.indexAddr);
|
||||
}
|
||||
|
||||
cyclesExecuted += EstimatePerVertexCost() * count;
|
||||
TransformUnit::SubmitPrimitive(verts, indices, type, count, gstate.vertType);
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user