Permalink
Browse files

Merge pull request #11210 from unknownbrackets/debugger

UI: Keep rendering UI even while stepping
  • Loading branch information...
hrydgard committed Jun 24, 2018
2 parents 4cfc6ee + ca8677d commit 608c34fb4e9d425f5e18eee9c7c0264c67af9437
Showing with 21 additions and 7 deletions.
  1. +10 −5 Core/Core.cpp
  2. +4 −0 Core/System.cpp
  3. +7 −2 UI/EmuScreen.cpp
@@ -225,7 +225,7 @@ void Core_RunLoop(GraphicsContext *ctx) {
}
}
while (!coreState && GetUIState() == UISTATE_INGAME) {
while ((coreState == CORE_RUNNING || coreState == CORE_STEPPING) && GetUIState() == UISTATE_INGAME) {
time_update();
UpdateRunLoop();
if (!windowHidden && !Core_IsStepping()) {
@@ -264,8 +264,9 @@ void Core_SingleStep() {
static inline bool Core_WaitStepping() {
std::unique_lock<std::mutex> guard(m_hStepMutex);
// We only wait 16ms so that we can still draw UI or react to events.
if (!singleStepPending && coreState == CORE_STEPPING)
m_StepCond.wait(guard);
m_StepCond.wait_for(guard, std::chrono::milliseconds(16));
bool result = singleStepPending;
singleStepPending = false;
@@ -285,9 +286,13 @@ void Core_ProcessStepping() {
GPUStepping::SingleStep();
// We're not inside jit now, so it's safe to clear the breakpoints.
CBreakPoints::ClearTemporaryBreakPoints();
host->UpdateDisassembly();
host->UpdateMemView();
static int lastSteppingCounter = -1;
if (lastSteppingCounter != steppingCounter) {
CBreakPoints::ClearTemporaryBreakPoints();
host->UpdateDisassembly();
host->UpdateMemView();
lastSteppingCounter = steppingCounter;
}
// Need to check inside the lock to avoid races.
bool doStep = Core_WaitStepping();
@@ -442,6 +442,10 @@ void PSP_RunLoopWhileState() {
// Run until CORE_NEXTFRAME
while (coreState == CORE_RUNNING || coreState == CORE_STEPPING) {
PSP_RunLoopFor(blockTicks);
if (coreState == CORE_STEPPING) {
// Keep the UI responsive.
break;
}
}
}
@@ -1230,8 +1230,13 @@ void EmuScreen::render() {
// set back to running for the next frame
coreState = CORE_RUNNING;
} else if (coreState == CORE_STEPPING) {
// If we're stepping, it's convenient not to clear the screen.
thin3d->BindFramebufferAsRenderTarget(nullptr, { RPAction::KEEP, RPAction::DONT_CARE, RPAction::DONT_CARE });
// If we're stepping, it's convenient not to clear the screen entirely, so we copy display to output.
// This won't work in non-buffered, but that's fine.
thin3d->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::DONT_CARE, RPAction::DONT_CARE });
// Just to make sure.
if (PSP_IsInited()) {
gpu->CopyDisplayToOutput();
}
} else {
// Didn't actually reach the end of the frame, ran out of the blockTicks cycles.
// In this case we need to bind and wipe the backbuffer, at least.

0 comments on commit 608c34f

Please sign in to comment.