From 4d5c8fcff4e5dbbc6a99ee42f8eaa66af0a915ff Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 1 Dec 2018 06:26:35 -0800 Subject: [PATCH] GE Debugger: Track a counter of prims. --- GPU/Debugger/Debugger.cpp | 22 ++++++++++++++++++++++ GPU/Debugger/Debugger.h | 3 +++ GPU/Debugger/Stepping.cpp | 1 + Windows/GEDebugger/GEDebugger.cpp | 5 +++++ Windows/ppsspp.rc | 17 +++++++++-------- Windows/resource.h | 3 ++- 6 files changed, 42 insertions(+), 9 deletions(-) diff --git a/GPU/Debugger/Debugger.cpp b/GPU/Debugger/Debugger.cpp index 088836c2ff..27083674b0 100644 --- a/GPU/Debugger/Debugger.cpp +++ b/GPU/Debugger/Debugger.cpp @@ -26,6 +26,10 @@ static bool active = false; static bool inited = false; static BreakNext breakNext = BreakNext::NONE; +static int primsLastFrame = 0; +static int primsThisFrame = 0; +static int thisFlipNum = 0; + static void Init() { if (!inited) { GPUBreakpoints::Init(); @@ -68,6 +72,16 @@ void NotifyCommand(u32 pc) { if (!active) return; u32 op = Memory::ReadUnchecked_U32(pc); + u32 cmd = op >> 24; + if (thisFlipNum != gpuStats.numFlips) { + primsLastFrame = primsThisFrame; + primsThisFrame = 0; + thisFlipNum = gpuStats.numFlips; + } + if (cmd == GE_CMD_PRIM || cmd == GE_CMD_BEZIER || cmd == GE_CMD_SPLINE) { + primsThisFrame++; + } + if (breakNext == BreakNext::OP || GPUBreakpoints::IsBreakpoint(pc, op)) { GPUBreakpoints::ClearTempBreakpoints(); @@ -100,4 +114,12 @@ void NotifyTextureAttachment(u32 texaddr) { return; } +int PrimsThisFrame() { + return primsThisFrame; +} + +int PrimsLastFrame() { + return primsLastFrame; +} + } diff --git a/GPU/Debugger/Debugger.h b/GPU/Debugger/Debugger.h index 2a45f93ba0..193b4630ec 100644 --- a/GPU/Debugger/Debugger.h +++ b/GPU/Debugger/Debugger.h @@ -43,4 +43,7 @@ void NotifyDraw(); void NotifyDisplay(u32 framebuf, u32 stride, int format); void NotifyTextureAttachment(u32 texaddr); +int PrimsThisFrame(); +int PrimsLastFrame(); + } diff --git a/GPU/Debugger/Stepping.cpp b/GPU/Debugger/Stepping.cpp index b277496556..bf5ddb4834 100644 --- a/GPU/Debugger/Stepping.cpp +++ b/GPU/Debugger/Stepping.cpp @@ -38,6 +38,7 @@ enum PauseAction { }; static bool isStepping; +// Number of times we've entered stepping, to detect a resume asynchronously. static int stepCounter = 0; static std::mutex pauseLock; diff --git a/Windows/GEDebugger/GEDebugger.cpp b/Windows/GEDebugger/GEDebugger.cpp index e36fe84a52..5d4f978357 100644 --- a/Windows/GEDebugger/GEDebugger.cpp +++ b/Windows/GEDebugger/GEDebugger.cpp @@ -291,6 +291,10 @@ void CGEDebugger::UpdatePreviews() { displayList->setDisplayList(list); } + wchar_t primCounter[1024]{}; + swprintf(primCounter, ARRAY_SIZE(primCounter), L"%d/%d", PrimsThisFrame(), PrimsLastFrame()); + SetDlgItemText(m_hDlg, IDC_GEDBG_PRIMCOUNTER, primCounter); + flags->Update(); lighting->Update(); textureState->Update(); @@ -778,6 +782,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { secondWindow->Clear(); SetDlgItemText(m_hDlg, IDC_GEDBG_FRAMEBUFADDR, L""); SetDlgItemText(m_hDlg, IDC_GEDBG_TEXADDR, L""); + SetDlgItemText(m_hDlg, IDC_GEDBG_PRIMCOUNTER, L""); SetBreakNext(BreakNext::NONE); break; diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index 4d3ae58dcf..3aa2993ec6 100644 --- a/Windows/ppsspp.rc +++ b/Windows/ppsspp.rc @@ -210,14 +210,15 @@ EXSTYLE WS_EX_ACCEPTFILES | WS_EX_TOOLWINDOW CAPTION "GE" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - PUSHBUTTON "Step &Frame",IDC_GEDBG_STEPFRAME,10,2,48,14 - PUSHBUTTON "Step &Tex",IDC_GEDBG_STEPTEX,62,2,48,14 - PUSHBUTTON "Step &Draw",IDC_GEDBG_STEPDRAW,114,2,48,14 - PUSHBUTTON "Step &Prim",IDC_GEDBG_STEPPRIM,166,2,48,14 - PUSHBUTTON "Step &Curve",IDC_GEDBG_STEPCURVE,218,2,48,14 - PUSHBUTTON "Step &Into",IDC_GEDBG_STEP,270,2,48,14 - PUSHBUTTON "&Resume",IDC_GEDBG_RESUME,322,2,48,14 - PUSHBUTTON "Rec&ord",IDC_GEDBG_RECORD,440,2,48,14 + PUSHBUTTON "Step &Frame",IDC_GEDBG_STEPFRAME,10,2,44,14 + PUSHBUTTON "Step &Tex",IDC_GEDBG_STEPTEX,55,2,44,14 + PUSHBUTTON "Step &Draw",IDC_GEDBG_STEPDRAW,100,2,44,14 + PUSHBUTTON "Step &Prim",IDC_GEDBG_STEPPRIM,145,2,44,14 + PUSHBUTTON "Step &Curve",IDC_GEDBG_STEPCURVE,190,2,44,14 + PUSHBUTTON "Step &Into",IDC_GEDBG_STEP,235,2,44,14 + EDITTEXT IDC_GEDBG_PRIMCOUNTER,340,4,44,12,ES_READONLY | NOT WS_BORDER + PUSHBUTTON "&Resume",IDC_GEDBG_RESUME,396,2,44,14 + PUSHBUTTON "Rec&ord",IDC_GEDBG_RECORD,444,2,44,14 CONTROL "",IDC_GEDBG_TEX,"SimpleGLWindow",WS_CHILD | WS_VISIBLE,10,20,128,128 CONTROL "",IDC_GEDBG_FRAME,"SimpleGLWindow",WS_CHILD | WS_VISIBLE,148,20,256,136 CONTROL "",IDC_GEDBG_MAINTAB,"SysTabControl32",TCS_TABS | TCS_FOCUSNEVER,10,216,480,180 diff --git a/Windows/resource.h b/Windows/resource.h index 7ae3fc5b45..1d56567dcd 100644 --- a/Windows/resource.h +++ b/Windows/resource.h @@ -165,6 +165,7 @@ #define IDC_GEDBG_SHOWCLUT 1198 #define IDC_BREAKPOINT_LOG_FORMAT 1199 #define IDC_SHOWOFFSETS 1200 +#define IDC_GEDBG_PRIMCOUNTER 1201 #define ID_SHADERS_BASE 5000 @@ -375,7 +376,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 256 #define _APS_NEXT_COMMAND_VALUE 40199 -#define _APS_NEXT_CONTROL_VALUE 1200 +#define _APS_NEXT_CONTROL_VALUE 1202 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif