Merge pull request #11099 from Pokechu22/draw_done_and_token_stats

VideoCommon: Add statistics for draw done and token commands
This commit is contained in:
Admiral H. Curtiss 2022-09-28 21:56:54 +02:00 committed by GitHub
commit 4de70f1e99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View File

@ -33,6 +33,7 @@
#include "VideoCommon/PixelEngine.h" #include "VideoCommon/PixelEngine.h"
#include "VideoCommon/PixelShaderManager.h" #include "VideoCommon/PixelShaderManager.h"
#include "VideoCommon/RenderBase.h" #include "VideoCommon/RenderBase.h"
#include "VideoCommon/Statistics.h"
#include "VideoCommon/TMEM.h" #include "VideoCommon/TMEM.h"
#include "VideoCommon/TextureCacheBase.h" #include "VideoCommon/TextureCacheBase.h"
#include "VideoCommon/TextureDecoder.h" #include "VideoCommon/TextureDecoder.h"
@ -177,6 +178,7 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
switch (bp.newvalue & 0xFF) switch (bp.newvalue & 0xFF)
{ {
case 0x02: case 0x02:
INCSTAT(g_stats.this_frame.num_draw_done);
g_texture_cache->FlushEFBCopies(); g_texture_cache->FlushEFBCopies();
g_framebuffer_manager->InvalidatePeekCache(false); g_framebuffer_manager->InvalidatePeekCache(false);
if (!Fifo::UseDeterministicGPUThread()) if (!Fifo::UseDeterministicGPUThread())
@ -190,6 +192,7 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
} }
return; return;
case BPMEM_PE_TOKEN_ID: // Pixel Engine Token ID case BPMEM_PE_TOKEN_ID: // Pixel Engine Token ID
INCSTAT(g_stats.this_frame.num_token);
g_texture_cache->FlushEFBCopies(); g_texture_cache->FlushEFBCopies();
g_framebuffer_manager->InvalidatePeekCache(false); g_framebuffer_manager->InvalidatePeekCache(false);
if (!Fifo::UseDeterministicGPUThread()) if (!Fifo::UseDeterministicGPUThread())
@ -197,6 +200,7 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
DEBUG_LOG_FMT(VIDEO, "SetPEToken {:#06X}", bp.newvalue & 0xFFFF); DEBUG_LOG_FMT(VIDEO, "SetPEToken {:#06X}", bp.newvalue & 0xFFFF);
return; return;
case BPMEM_PE_TOKEN_INT_ID: // Pixel Engine Interrupt Token ID case BPMEM_PE_TOKEN_INT_ID: // Pixel Engine Interrupt Token ID
INCSTAT(g_stats.this_frame.num_token_int);
g_texture_cache->FlushEFBCopies(); g_texture_cache->FlushEFBCopies();
g_framebuffer_manager->InvalidatePeekCache(false); g_framebuffer_manager->InvalidatePeekCache(false);
if (!Fifo::UseDeterministicGPUThread()) if (!Fifo::UseDeterministicGPUThread())

View File

@ -93,6 +93,8 @@ void Statistics::Display() const
draw_statistic("Vertex Loaders", "%d", num_vertex_loaders); draw_statistic("Vertex Loaders", "%d", num_vertex_loaders);
draw_statistic("EFB peeks:", "%d", this_frame.num_efb_peeks); draw_statistic("EFB peeks:", "%d", this_frame.num_efb_peeks);
draw_statistic("EFB pokes:", "%d", this_frame.num_efb_pokes); draw_statistic("EFB pokes:", "%d", this_frame.num_efb_pokes);
draw_statistic("Draw dones:", "%d", this_frame.num_draw_done);
draw_statistic("Tokens:", "%d/%d", this_frame.num_token, this_frame.num_token_int);
ImGui::Columns(1); ImGui::Columns(1);

View File

@ -71,6 +71,10 @@ struct Statistics
int num_efb_peeks; int num_efb_peeks;
int num_efb_pokes; int num_efb_pokes;
int num_draw_done;
int num_token;
int num_token_int;
}; };
ThisFrame this_frame; ThisFrame this_frame;
void ResetFrame(); void ResetFrame();