Skip to content

Commit

Permalink
Add a new stat, so we can see per game if the optimization has an effect
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Oct 3, 2023
1 parent 1c49d57 commit e63bb04
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions GPU/D3D11/DrawEngineD3D11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,7 @@ void DrawEngineD3D11::DoFlush() {

gpuStats.numFlushes++;
gpuStats.numDrawCalls += numDrawInds_;
gpuStats.numVertexDecodes += numDrawVerts_;
gpuStats.numVertsSubmitted += vertexCountInDrawCalls_;

indexGen.Reset();
Expand Down
1 change: 1 addition & 0 deletions GPU/Directx9/DrawEngineDX9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ void DrawEngineDX9::DoFlush() {

gpuStats.numFlushes++;
gpuStats.numDrawCalls += numDrawInds_;
gpuStats.numVertexDecodes += numDrawVerts_;
gpuStats.numVertsSubmitted += vertexCountInDrawCalls_;

// TODO: The below should be shared.
Expand Down
1 change: 1 addition & 0 deletions GPU/GLES/DrawEngineGLES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ void DrawEngineGLES::DoFlush() {
bail:
gpuStats.numFlushes++;
gpuStats.numDrawCalls += numDrawInds_;
gpuStats.numVertexDecodes += numDrawVerts_;
gpuStats.numVertsSubmitted += vertexCountInDrawCalls_;

// TODO: When the next flush has the same vertex format, we can continue with the same offset in the vertex buffer,
Expand Down
2 changes: 2 additions & 0 deletions GPU/GPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ struct GPUStatistics {

void ResetFrame() {
numDrawCalls = 0;
numVertexDecodes = 0;
numDrawSyncs = 0;
numListSyncs = 0;
numCachedDrawCalls = 0;
Expand Down Expand Up @@ -111,6 +112,7 @@ struct GPUStatistics {

// Per frame statistics
int numDrawCalls;
int numVertexDecodes;
int numDrawSyncs;
int numListSyncs;
int numCachedDrawCalls;
Expand Down
3 changes: 2 additions & 1 deletion GPU/GPUCommonHW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1647,7 +1647,7 @@ size_t GPUCommonHW::FormatGPUStatsCommon(char *buffer, size_t size) {
float vertexAverageCycles = gpuStats.numVertsSubmitted > 0 ? (float)gpuStats.vertexGPUCycles / (float)gpuStats.numVertsSubmitted : 0.0f;
return snprintf(buffer, size,
"DL processing time: %0.2f ms, %d drawsync, %d listsync\n"
"Draw calls: %d, flushes %d, clears %d, bbox jumps %d (%d updates)\n"
"Draw: %d (%d dec), flushes %d, clears %d, bbox jumps %d (%d updates)\n"
"Cached draws: %d (tracked: %d)\n"
"Vertices: %d cached: %d uncached: %d\n"
"FBOs active: %d (evaluations: %d)\n"
Expand All @@ -1660,6 +1660,7 @@ size_t GPUCommonHW::FormatGPUStatsCommon(char *buffer, size_t size) {
gpuStats.numDrawSyncs,
gpuStats.numListSyncs,
gpuStats.numDrawCalls,
gpuStats.numVertexDecodes,
gpuStats.numFlushes,
gpuStats.numClears,
gpuStats.numBBOXJumps,
Expand Down
1 change: 1 addition & 0 deletions GPU/Vulkan/DrawEngineVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,7 @@ void DrawEngineVulkan::DoFlush() {

gpuStats.numFlushes++;
gpuStats.numDrawCalls += numDrawInds_;
gpuStats.numVertexDecodes += numDrawVerts_;
gpuStats.numVertsSubmitted += vertexCountInDrawCalls_;

indexGen.Reset();
Expand Down

0 comments on commit e63bb04

Please sign in to comment.