Fix the prim counting to act as before

This commit is contained in:
Henrik Rydgård 2024-12-17 12:02:24 +01:00
parent b5ed3051e5
commit 0af8c558a0
4 changed files with 25 additions and 15 deletions

View file

@ -38,6 +38,7 @@ const char *BreakNextToString(BreakNext next) {
case BreakNext::CURVE: return "CURVE";
case BreakNext::BLOCK_TRANSFER: return "BLOCK_TRANSFER";
case BreakNext::COUNT: return "COUNT";
case BreakNext::DEBUG_RUN: return "DEBUG_RUN";
default: return "N/A";
}
}

View file

@ -35,6 +35,7 @@ enum class BreakNext {
PRIM,
CURVE,
BLOCK_TRANSFER,
DEBUG_RUN, // This is just running as normal, but with debug instrumentation.
COUNT,
};

View file

@ -2074,9 +2074,10 @@ GPUDebug::NotifyResult GPUCommon::NotifyCommand(u32 pc, GPUBreakpoints *breakpoi
bool isPrim = false;
bool process = true;
bool process = true; // Process is only for the restrictPrimRanges functionality
if (cmd == GE_CMD_PRIM || cmd == GE_CMD_BEZIER || cmd == GE_CMD_SPLINE || cmd == GE_CMD_VAP || cmd == GE_CMD_TRANSFERSTART) { // VAP is immediate mode prims.
isPrim = true;
primsThisFrame_++;
// TODO: Should restricted prim ranges also avoid breakpoints?
@ -2103,7 +2104,9 @@ GPUDebug::NotifyResult GPUCommon::NotifyCommand(u32 pc, GPUBreakpoints *breakpoi
if (debugBreak && pc == skipPcOnce_) {
INFO_LOG(Log::GeDebugger, "Skipping GE break at %08x (last break was here)", skipPcOnce_);
skipPcOnce_ = 0;
goto bail;
if (isPrim)
primsThisFrame_--; // Compensate for the wrong increment above - we didn't run anything.
return process ? NotifyResult::Execute : NotifyResult::Skip;
}
skipPcOnce_ = 0;
@ -2112,7 +2115,7 @@ GPUDebug::NotifyResult GPUCommon::NotifyCommand(u32 pc, GPUBreakpoints *breakpoi
if (coreState == CORE_POWERDOWN) {
breakNext_ = BreakNext::NONE;
goto bail;
return process ? NotifyResult::Execute : NotifyResult::Skip;
}
u32 op = Memory::Read_U32(pc);
@ -2125,14 +2128,7 @@ GPUDebug::NotifyResult GPUCommon::NotifyCommand(u32 pc, GPUBreakpoints *breakpoi
return NotifyResult::Break; // caller will call GPUStepping::EnterStepping().
}
bail:
if (process) {
if (isPrim)
primsThisFrame_++;
return NotifyResult::Execute;
} else {
return NotifyResult::Skip;
}
return process ? NotifyResult::Execute : NotifyResult::Skip;
}
void GPUCommon::NotifyFlush() {

View file

@ -751,7 +751,19 @@ void ImGeDebuggerWindow::Draw(ImConfig &cfg, ImControl &control, GPUDebugInterfa
ImGui::BeginDisabled(coreState != CORE_STEPPING_GE);
if (ImGui::Button("Run/Resume")) {
Core_Resume();
// Core_Resume();
gpuDebug->SetBreakNext(GPUDebug::BreakNext::DEBUG_RUN);
}
ImGui::SameLine();
if (ImGui::Button("...")) {
ImGui::OpenPopup("dotdotdot");
}
if (ImGui::BeginPopup("dotdotdot")) {
if (ImGui::MenuItem("RunFast")) {
gpuDebug->ClearBreakNext();
Core_Resume();
}
ImGui::EndPopup();
}
ImGui::EndDisabled();
ImGui::SameLine();
@ -762,7 +774,7 @@ void ImGeDebuggerWindow::Draw(ImConfig &cfg, ImControl &control, GPUDebugInterfa
// GPUDebug::SetBreakNext(GPUDebug::BreakNext::FRAME);
//}
bool disableStepButtons = gpuDebug->GetBreakNext() != GPUDebug::BreakNext::NONE;
bool disableStepButtons = gpuDebug->GetBreakNext() != GPUDebug::BreakNext::NONE && gpuDebug->GetBreakNext() != GPUDebug::BreakNext::DEBUG_RUN;
if (disableStepButtons) {
ImGui::BeginDisabled();
@ -828,7 +840,7 @@ void ImGeDebuggerWindow::Draw(ImConfig &cfg, ImControl &control, GPUDebugInterfa
disasmView_.GotoPC();
}
ImGui::SameLine();
if (ImGui::SmallButton("Settings")) {
if (ImGui::Button("Settings")) {
ImGui::OpenPopup("disSettings");
}
if (ImGui::BeginPopup("disSettings")) {
@ -837,7 +849,7 @@ void ImGeDebuggerWindow::Draw(ImConfig &cfg, ImControl &control, GPUDebugInterfa
}
// Display any pending step event.
if (gpuDebug->GetBreakNext() != GPUDebug::BreakNext::NONE) {
if (gpuDebug->GetBreakNext() != GPUDebug::BreakNext::NONE && gpuDebug->GetBreakNext() != GPUDebug::BreakNext::DEBUG_RUN) {
if (showBannerInFrames_ > 0) {
showBannerInFrames_--;
}