Permalink
Browse files

GE Debugger: Allow jumping to a specific prim.

This will make the most sense when frames are relatively stable, and works
great for GE dumps.
  • Loading branch information...
unknownbrackets committed Dec 1, 2018
1 parent 4d5c8fc commit e029168be2fc0a92975f99a8e6381446e11adebc
Showing with 39 additions and 4 deletions.
  1. +19 −2 GPU/Debugger/Debugger.cpp
  2. +2 −0 GPU/Debugger/Debugger.h
  3. +14 −0 Windows/GEDebugger/GEDebugger.cpp
  4. +2 −1 Windows/ppsspp.rc
  5. +2 −1 Windows/resource.h
@@ -25,6 +25,7 @@ namespace GPUDebug {
static bool active = false;
static bool inited = false;
static BreakNext breakNext = BreakNext::NONE;
static int breakAtCount = -1;
static int primsLastFrame = 0;
static int primsThisFrame = 0;
@@ -44,6 +45,7 @@ void SetActive(bool flag) {
active = flag;
if (!active) {
breakNext = BreakNext::NONE;
breakAtCount = -1;
GPUStepping::ResumeFromStepping();
}
}
@@ -55,9 +57,10 @@ bool IsActive() {
void SetBreakNext(BreakNext next) {
SetActive(true);
breakNext = next;
breakAtCount = -1;
if (next == BreakNext::TEX) {
GPUBreakpoints::AddTextureChangeTempBreakpoint();
} else if (next == BreakNext::PRIM) {
} else if (next == BreakNext::PRIM || next == BreakNext::COUNT) {
GPUBreakpoints::AddCmdBreakpoint(GE_CMD_PRIM, true);
GPUBreakpoints::AddCmdBreakpoint(GE_CMD_BEZIER, true);
GPUBreakpoints::AddCmdBreakpoint(GE_CMD_SPLINE, true);
@@ -68,6 +71,20 @@ void SetBreakNext(BreakNext next) {
GPUStepping::ResumeFromStepping();
}
void SetBreakCount(int c) {
breakAtCount = c;
}
static bool IsBreakpoint(u32 pc, u32 op) {
if (breakNext == BreakNext::OP) {
return true;
} else if (breakNext == BreakNext::COUNT) {
return primsThisFrame == breakAtCount;
} else {
return GPUBreakpoints::IsBreakpoint(pc, op);
}
}
void NotifyCommand(u32 pc) {
if (!active)
return;
@@ -82,7 +99,7 @@ void NotifyCommand(u32 pc) {
primsThisFrame++;
}
if (breakNext == BreakNext::OP || GPUBreakpoints::IsBreakpoint(pc, op)) {
if (IsBreakpoint(pc, op)) {
GPUBreakpoints::ClearTempBreakpoints();
auto info = gpuDebug->DissassembleOp(pc);
@@ -30,12 +30,14 @@ enum class BreakNext {
FRAME,
PRIM,
CURVE,
COUNT,
};
void SetActive(bool flag);
bool IsActive();
void SetBreakNext(BreakNext next);
void SetBreakCount(int c);
// While debugging is active, these may block.
void NotifyCommand(u32 pc);
@@ -20,6 +20,7 @@
#include <string>
#include <vector>
#include "base/stringutil.h"
#include "Common/ColorConv.h"
#include "Core/Config.h"
#include "Core/Screenshot.h"
@@ -724,6 +725,19 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
SetBreakNext(BreakNext::CURVE);
break;
case IDC_GEDBG_STEPCOUNT:
{
std::string value;
int count;
if (InputBox_GetString(GetModuleHandle(NULL), m_hDlg, L"Prim count", "", value)) {
if (TryParse(value, &count)) {
SetBreakNext(BreakNext::COUNT);
SetBreakCount(count);
}
}
}
break;
case IDC_GEDBG_BREAKTEX:
{
GPUDebug::SetActive(true);
@@ -216,7 +216,8 @@ BEGIN
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 "Step Cou&nt",IDC_GEDBG_STEPCOUNT,280,2,44,14
EDITTEXT IDC_GEDBG_PRIMCOUNTER,325,4,50,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
@@ -363,6 +363,7 @@
#define ID_OPTIONS_TEXTUREFILTERING_MENU 40196
#define ID_OPTIONS_SCREENFILTER_MENU 40197
#define ID_OPTIONS_TEXTURESCALING_MENU 40198
#define IDC_GEDBG_STEPCOUNT 40199
// Dummy option to let the buffered rendering hotkey cycle through all the options.
#define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500
@@ -375,7 +376,7 @@
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 256
#define _APS_NEXT_COMMAND_VALUE 40199
#define _APS_NEXT_COMMAND_VALUE 40200
#define _APS_NEXT_CONTROL_VALUE 1202
#define _APS_NEXT_SYMED_VALUE 101
#endif

0 comments on commit e029168

Please sign in to comment.