mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 21:39:52 +00:00
Some very minor optimizations. Remove little-used stat counter.
This commit is contained in:
parent
87bcb56e95
commit
7cb5e7f53f
@ -134,8 +134,7 @@ void PrintDecodedVertex(VertexReader &vtx) {
|
||||
printf("P: %f %f %f\n", pos[0], pos[1], pos[2]);
|
||||
}
|
||||
|
||||
VertexDecoder::VertexDecoder() : coloff(0), nrmoff(0), posoff(0), jitted_(0) {
|
||||
memset(stats_, 0, sizeof(stats_));
|
||||
VertexDecoder::VertexDecoder() : jitted_(0) {
|
||||
}
|
||||
|
||||
void VertexDecoder::Step_WeightsU8() const
|
||||
@ -1090,7 +1089,6 @@ int VertexDecoder::ToString(char *output) const {
|
||||
output += sprintf(output, "I: %i ", idx);
|
||||
if (morphcount > 1)
|
||||
output += sprintf(output, "Morph: %i ", morphcount);
|
||||
output += sprintf(output, "Verts: %i ", stats_[STAT_VERTSSUBMITTED]);
|
||||
if (throughmode)
|
||||
output += sprintf(output, " (through)");
|
||||
|
||||
|
@ -85,11 +85,6 @@ struct TransformedVertex
|
||||
|
||||
void GetIndexBounds(const void *inds, int count, u32 vertType, u16 *indexLowerBound, u16 *indexUpperBound);
|
||||
|
||||
enum {
|
||||
STAT_VERTSSUBMITTED = 0,
|
||||
NUM_VERTEX_DECODER_STATS = 1
|
||||
};
|
||||
|
||||
inline int RoundUp4(int x) {
|
||||
return (x + 3) & ~3;
|
||||
}
|
||||
@ -524,14 +519,6 @@ public:
|
||||
void Step_PosS16Through() const;
|
||||
void Step_PosFloatThrough() const;
|
||||
|
||||
void ResetStats() {
|
||||
memset(stats_, 0, sizeof(stats_));
|
||||
}
|
||||
|
||||
void IncrementStat(int stat, int amount) {
|
||||
stats_[stat] += amount;
|
||||
}
|
||||
|
||||
// output must be big for safety.
|
||||
// Returns number of chars written.
|
||||
// Ugly for speed.
|
||||
@ -541,9 +528,11 @@ public:
|
||||
mutable u8 *decoded_;
|
||||
mutable const u8 *ptr_;
|
||||
|
||||
JittedVertexDecoder jitted_;
|
||||
|
||||
// "Immutable" state, set at startup
|
||||
|
||||
// The decoding steps
|
||||
// The decoding steps. Never more than 5.
|
||||
StepFunction steps_[5];
|
||||
int numSteps_;
|
||||
|
||||
@ -551,28 +540,23 @@ public:
|
||||
DecVtxFormat decFmt;
|
||||
|
||||
bool throughmode;
|
||||
int biggest;
|
||||
int size;
|
||||
int onesize_;
|
||||
u8 size;
|
||||
u8 onesize_;
|
||||
|
||||
int weightoff;
|
||||
int tcoff;
|
||||
int coloff;
|
||||
int nrmoff;
|
||||
int posoff;
|
||||
u8 weightoff;
|
||||
u8 tcoff;
|
||||
u8 coloff;
|
||||
u8 nrmoff;
|
||||
u8 posoff;
|
||||
|
||||
int tc;
|
||||
int col;
|
||||
int nrm;
|
||||
int pos;
|
||||
int weighttype;
|
||||
int idx;
|
||||
int morphcount;
|
||||
int nweights;
|
||||
|
||||
int stats_[NUM_VERTEX_DECODER_STATS];
|
||||
|
||||
JittedVertexDecoder jitted_;
|
||||
u8 tc;
|
||||
u8 col;
|
||||
u8 nrm;
|
||||
u8 pos;
|
||||
u8 weighttype;
|
||||
u8 idx;
|
||||
u8 morphcount;
|
||||
u8 nweights;
|
||||
|
||||
friend class VertexDecoderJitCache;
|
||||
};
|
||||
|
@ -98,7 +98,8 @@ void TransformDrawEngineDX9::SubmitSpline(void* control_points, void* indices, i
|
||||
gstate_c.uv.uOff = 0;
|
||||
gstate_c.uv.vOff = 0;
|
||||
}
|
||||
SubmitPrim(decoded2, quadIndices_, GE_PRIM_TRIANGLES, count, vertTypeWithIndex16, 0);
|
||||
int bytesRead;
|
||||
SubmitPrim(decoded2, quadIndices_, GE_PRIM_TRIANGLES, count, vertTypeWithIndex16, &bytesRead);
|
||||
|
||||
Flush();
|
||||
|
||||
@ -190,7 +191,8 @@ void TransformDrawEngineDX9::SubmitBezier(void* control_points, void* indices, i
|
||||
gstate_c.uv.vOff = 0;
|
||||
}
|
||||
|
||||
SubmitPrim(decoded2, quadIndices_, GE_PRIM_TRIANGLES, count, vertTypeWithIndex16, 0);
|
||||
int bytesRead;
|
||||
SubmitPrim(decoded2, quadIndices_, GE_PRIM_TRIANGLES, count, vertTypeWithIndex16, &bytesRead);
|
||||
Flush();
|
||||
|
||||
if (g_Config.bPrescaleUV) {
|
||||
|
@ -293,30 +293,22 @@ inline void TransformDrawEngineDX9::SetupVertexDecoderInternal(u32 vertType) {
|
||||
}
|
||||
|
||||
void TransformDrawEngineDX9::SubmitPrim(void *verts, void *inds, GEPrimitiveType prim, int vertexCount, u32 vertType, int *bytesRead) {
|
||||
if (vertexCount == 0)
|
||||
return; // we ignore zero-sized draw calls.
|
||||
|
||||
if (!indexGen.PrimCompatible(prevPrim_, prim) || numDrawCalls >= MAX_DEFERRED_DRAW_CALLS || vertexCountInDrawCalls + vertexCount > VERTEX_BUFFER_MAX)
|
||||
Flush();
|
||||
|
||||
// TODO: Is this the right thing to do?
|
||||
if (prim == GE_PRIM_KEEP_PREVIOUS) {
|
||||
prim = prevPrim_;
|
||||
}
|
||||
prevPrim_ = prim;
|
||||
|
||||
if ((vertexCount < 2 && prim > 0) || (vertexCount < 3 && prim > 2 && prim != GE_PRIM_RECTANGLES))
|
||||
return;
|
||||
|
||||
// TODO: Is this the right thing to do?
|
||||
if (prim == GE_PRIM_KEEP_PREVIOUS) {
|
||||
prim = prevPrim_;
|
||||
} else {
|
||||
prevPrim_ = prim;
|
||||
}
|
||||
|
||||
SetupVertexDecoderInternal(vertType);
|
||||
|
||||
dec_->IncrementStat(STAT_VERTSSUBMITTED, vertexCount);
|
||||
|
||||
if (bytesRead)
|
||||
*bytesRead = vertexCount * dec_->VertexSize();
|
||||
|
||||
gpuStats.numDrawCalls++;
|
||||
gpuStats.numVertsSubmitted += vertexCount;
|
||||
*bytesRead = vertexCount * dec_->VertexSize();
|
||||
|
||||
DeferredDrawCall &dc = drawCalls[numDrawCalls];
|
||||
dc.verts = verts;
|
||||
@ -358,6 +350,7 @@ void TransformDrawEngineDX9::SubmitPrim(void *verts, void *inds, GEPrimitiveType
|
||||
}
|
||||
|
||||
if (prim == GE_PRIM_RECTANGLES && (gstate.getTextureAddress(0) & 0x3FFFFFFF) == (gstate.getFrameBufAddress() & 0x3FFFFFFF)) {
|
||||
// Rendertarget == texture?
|
||||
if (!g_Config.bDisableSlowFramebufEffects) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
Flush();
|
||||
@ -888,6 +881,9 @@ rotateVBO:
|
||||
}
|
||||
}
|
||||
|
||||
gpuStats.numDrawCalls += numDrawCalls;
|
||||
gpuStats.numVertsSubmitted += vertexCountInDrawCalls;
|
||||
|
||||
indexGen.Reset();
|
||||
decodedVerts_ = 0;
|
||||
numDrawCalls = 0;
|
||||
|
@ -100,7 +100,8 @@ void TransformDrawEngine::SubmitSpline(void* control_points, void* indices, int
|
||||
gstate_c.uv.uOff = 0;
|
||||
gstate_c.uv.vOff = 0;
|
||||
}
|
||||
SubmitPrim(decoded2, quadIndices_, GE_PRIM_TRIANGLES, count, vertTypeWithIndex16, 0);
|
||||
int bytesRead;
|
||||
SubmitPrim(decoded2, quadIndices_, GE_PRIM_TRIANGLES, count, vertTypeWithIndex16, &bytesRead);
|
||||
|
||||
Flush();
|
||||
|
||||
@ -192,7 +193,8 @@ void TransformDrawEngine::SubmitBezier(void* control_points, void* indices, int
|
||||
gstate_c.uv.vOff = 0;
|
||||
}
|
||||
|
||||
SubmitPrim(decoded2, quadIndices_, GE_PRIM_TRIANGLES, count, vertTypeWithIndex16, 0);
|
||||
int bytesRead;
|
||||
SubmitPrim(decoded2, quadIndices_, GE_PRIM_TRIANGLES, count, vertTypeWithIndex16, &bytesRead);
|
||||
Flush();
|
||||
|
||||
if (g_Config.bPrescaleUV) {
|
||||
|
@ -275,27 +275,22 @@ inline void TransformDrawEngine::SetupVertexDecoderInternal(u32 vertType) {
|
||||
}
|
||||
|
||||
void TransformDrawEngine::SubmitPrim(void *verts, void *inds, GEPrimitiveType prim, int vertexCount, u32 vertType, int *bytesRead) {
|
||||
if (vertexCount == 0)
|
||||
return; // we ignore zero-sized draw calls.
|
||||
|
||||
if (!indexGen.PrimCompatible(prevPrim_, prim) || numDrawCalls >= MAX_DEFERRED_DRAW_CALLS || vertexCountInDrawCalls + vertexCount > VERTEX_BUFFER_MAX)
|
||||
Flush();
|
||||
|
||||
if ((vertexCount < 2 && prim > 0) || (vertexCount < 3 && prim > 2 && prim != GE_PRIM_RECTANGLES))
|
||||
return;
|
||||
|
||||
// TODO: Is this the right thing to do?
|
||||
if (prim == GE_PRIM_KEEP_PREVIOUS) {
|
||||
prim = prevPrim_;
|
||||
} else {
|
||||
prevPrim_ = prim;
|
||||
}
|
||||
prevPrim_ = prim;
|
||||
|
||||
SetupVertexDecoderInternal(vertType);
|
||||
|
||||
dec_->IncrementStat(STAT_VERTSSUBMITTED, vertexCount);
|
||||
|
||||
if (bytesRead)
|
||||
*bytesRead = vertexCount * dec_->VertexSize();
|
||||
|
||||
gpuStats.numDrawCalls++;
|
||||
gpuStats.numVertsSubmitted += vertexCount;
|
||||
*bytesRead = vertexCount * dec_->VertexSize();
|
||||
|
||||
DeferredDrawCall &dc = drawCalls[numDrawCalls];
|
||||
dc.verts = verts;
|
||||
@ -337,6 +332,7 @@ void TransformDrawEngine::SubmitPrim(void *verts, void *inds, GEPrimitiveType pr
|
||||
}
|
||||
|
||||
if (prim == GE_PRIM_RECTANGLES && (gstate.getTextureAddress(0) & 0x3FFFFFFF) == (gstate.getFrameBufAddress() & 0x3FFFFFFF)) {
|
||||
// Rendertarget == texture?
|
||||
if (!g_Config.bDisableSlowFramebufEffects) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
Flush();
|
||||
@ -902,6 +898,9 @@ rotateVBO:
|
||||
}
|
||||
}
|
||||
|
||||
gpuStats.numDrawCalls += numDrawCalls;
|
||||
gpuStats.numVertsSubmitted += vertexCountInDrawCalls;
|
||||
|
||||
indexGen.Reset();
|
||||
decodedVerts_ = 0;
|
||||
numDrawCalls = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user