Permalink
Browse files

GE Debugger: Track a counter of prims.

  • Loading branch information...
unknownbrackets committed Dec 1, 2018
1 parent 571ea0e commit 4d5c8fcff4e5dbbc6a99ee42f8eaa66af0a915ff
@@ -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;
}
}
@@ -43,4 +43,7 @@ void NotifyDraw();
void NotifyDisplay(u32 framebuf, u32 stride, int format);
void NotifyTextureAttachment(u32 texaddr);
int PrimsThisFrame();
int PrimsLastFrame();
}
@@ -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;
@@ -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;
@@ -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
@@ -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

0 comments on commit 4d5c8fc

Please sign in to comment.