Simplifications

This commit is contained in:
Henrik Rydgård committed 2024-12-15 16:09:42 +01:00
1 parent 54d18bb343
commit dda3ddf6b0
6 files changed
+36 -40

No files matched your search

+3 -6
View File
@@ -213,9 +213,6 @@ public:
virtual void ResetListStall(int listID, u32 stall) = 0;
virtual void ResetListState(int listID, DisplayListState state) = 0;
GPUDebugOp DisassembleOp(u32 pc) {
return DisassembleOp(pc, Memory::Read_U32(pc));
}
virtual GPUDebugOp DisassembleOp(u32 pc, u32 op) = 0;
virtual std::vector<GPUDebugOp> DisassembleOpRange(u32 startpc, u32 endpc) = 0;
@@ -245,10 +242,10 @@ public:
virtual const std::list<int> &GetDisplayListQueue() = 0;
virtual const DisplayList &GetDisplayList(int index) = 0;
virtual int PrimsThisFrame() = 0;
virtual int PrimsLastFrame() = 0;
virtual int PrimsThisFrame() const = 0;
virtual int PrimsLastFrame() const = 0;
virtual void ClearBreakNext() = 0 ;
virtual void ClearBreakNext() = 0;
virtual void SetBreakNext(GPUDebug::BreakNext next) = 0 ;
virtual void SetBreakCount(int c, bool relative = false) = 0 ;
virtual GPUDebug::BreakNext GetBreakNext() = 0 ;
-4
View File
@@ -45,10 +45,6 @@ static bool isStepping;
// Number of times we've entered stepping, to detect a resume asynchronously.
static int stepCounter = 0;
// Debug stats.
static double g_timeSteppingStarted;
static double g_timeSpentStepping;
static std::mutex pauseLock;
static PauseAction pauseAction = PAUSE_CONTINUE;
static std::mutex actionLock;
+21 -24
View File
@@ -620,7 +620,12 @@ void GPUCommon::PSPFrame() {
} else if (dumpThisFrame_) {
dumpThisFrame_ = false;
}
NotifyBeginFrame();
if (breakNext == GPUDebug::BreakNext::VSYNC) {
// Just start stepping as soon as we can once the vblank finishes.
breakNext = GPUDebug::BreakNext::OP;
}
recorder_.NotifyBeginFrame();
}
// Returns false on breakpoint.
@@ -2019,20 +2024,28 @@ GPUDebug::BreakNext GPUCommon::GetBreakNext() {
void GPUCommon::SetBreakNext(GPUDebug::BreakNext next) {
breakNext = next;
breakAtCount = -1;
if (next == GPUDebug::BreakNext::TEX) {
switch (next) {
case GPUDebug::BreakNext::TEX:
breakpoints_.AddTextureChangeTempBreakpoint();
} else if (next == GPUDebug::BreakNext::PRIM || next == GPUDebug::BreakNext::COUNT) {
break;
case GPUDebug::BreakNext::PRIM:
case GPUDebug::BreakNext::COUNT:
breakpoints_.AddCmdBreakpoint(GE_CMD_PRIM, true);
breakpoints_.AddCmdBreakpoint(GE_CMD_BEZIER, true);
breakpoints_.AddCmdBreakpoint(GE_CMD_SPLINE, true);
breakpoints_.AddCmdBreakpoint(GE_CMD_VAP, true);
} else if (next == GPUDebug::BreakNext::CURVE) {
break;
case GPUDebug::BreakNext::CURVE:
breakpoints_.AddCmdBreakpoint(GE_CMD_BEZIER, true);
breakpoints_.AddCmdBreakpoint(GE_CMD_SPLINE, true);
} else if (next == GPUDebug::BreakNext::DRAW) {
break;
case GPUDebug::BreakNext::DRAW:
// This is now handled by switching to BreakNext::PRIM when we encounter a flush.
// This will take us to the following actual draw.
primAfterDraw_ = true;
break;
default:
break;
}
if (GPUStepping::IsStepping()) {
@@ -2093,12 +2106,13 @@ GPUDebug::NotifyResult GPUCommon::NotifyCommand(u32 pc, GPUBreakpoints *breakpoi
if (isBreakpoint) {
breakpoints->ClearTempBreakpoints();
if (coreState == CORE_POWERDOWN || !gpuDebug) {
if (coreState == CORE_POWERDOWN) {
breakNext = BreakNext::NONE;
return process ? NotifyResult::Execute : NotifyResult::Skip;
}
auto info = gpuDebug->DisassembleOp(pc);
u32 op = Memory::Read_U32(pc);
auto info = DisassembleOp(pc, op);
NOTICE_LOG(Log::GeDebugger, "Waiting at %08x, %s", pc, info.desc.c_str());
g_skipPcOnce = pc;
@@ -2131,23 +2145,6 @@ void GPUCommon::NotifyDisplay(u32 framebuf, u32 stride, int format) {
recorder_.NotifyDisplay(framebuf, stride, format);
}
void GPUCommon::NotifyBeginFrame() {
using namespace GPUDebug;
if (breakNext == BreakNext::VSYNC) {
// Just start stepping as soon as we can once the vblank finishes.
breakNext = BreakNext::OP;
}
recorder_.NotifyBeginFrame();
}
int GPUCommon::PrimsThisFrame() {
return primsThisFrame;
}
int GPUCommon::PrimsLastFrame() {
return primsLastFrame;
}
bool GPUCommon::SetRestrictPrims(std::string_view rule) {
if (rule.empty() || rule == "*") {
restrictPrimRanges.clear();
+6 -3
View File
@@ -392,15 +392,18 @@ public:
bool SetRestrictPrims(std::string_view rule) override;
const char *GetRestrictPrims() override;
int PrimsThisFrame() override;
int PrimsLastFrame() override;
int PrimsThisFrame() const override {
return primsThisFrame;
}
int PrimsLastFrame() const override {
return primsLastFrame;
}
void NotifyFlush();
protected:
// While debugging is active, these may block.
void NotifyDisplay(u32 framebuf, u32 stride, int format);
void NotifyBeginFrame();
bool NeedsSlowInterpreter() const;
GPUDebug::NotifyResult NotifyCommand(u32 pc, GPUBreakpoints *breakpoints);
+4 -2
View File
@@ -150,7 +150,8 @@ void ImGeDisasmView::Draw(GPUDebugInterface *gpuDebug) {
if (Memory::IsValid4AlignedAddress(addr)) {
draw_list->AddText(lineStart, 0xFFC0C0C0, addrBuffer);
GPUDebugOp op = gpuDebug->DisassembleOp(addr);
u32 opcode = Memory::Read_U32(addr);
GPUDebugOp op = gpuDebug->DisassembleOp(addr, opcode);
u32 color = 0xFFFFFFFF;
char temp[16];
snprintf(temp, sizeof(temp), "%08x", op.op);
@@ -212,7 +213,8 @@ void ImGeDisasmView::Draw(GPUDebugInterface *gpuDebug) {
}
} else if (Memory::IsValid4AlignedAddress(dragAddr_)) {
char buffer[64];
GPUDebugOp op = gpuDebug->DisassembleOp(pc);
u32 opcode = Memory::Read_U32(dragAddr_);
GPUDebugOp op = gpuDebug->DisassembleOp(dragAddr_, opcode);
// affect dragAddr_?
if (ImGui::MenuItem("Copy Address", NULL, false)) {
snprintf(buffer, sizeof(buffer), "%08x", dragAddr_);
+2 -1
View File
@@ -341,7 +341,8 @@ void CtrlDisplayListView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
char *p = temp, *end = temp + space;
for (u32 pos = selectRangeStart; pos < selectRangeEnd && p < end; pos += instructionSize)
{
GPUDebugOp op = gpuDebug->DisassembleOp(pos);
u32 opcode = Memory::Read_U32(pos);
GPUDebugOp op = gpuDebug->DisassembleOp(pos, opcode);
p += snprintf(p, end - p, "%s\r\n", op.desc.c_str());
}