Skip to content

Commit

Permalink
Ge: Restore saved context when ending a list.
Browse files Browse the repository at this point in the history
Otherwise another list queued by a Head push could use the wrong context
data.  See hrydgard#13346.
  • Loading branch information
unknownbrackets committed Jan 31, 2021
1 parent 5041a89 commit f2ad475
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions GPU/GPUCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1480,17 +1480,21 @@ void GPUCommon::Execute_End(u32 op, u32 diff) {
default:
currentList->subIntrToken = prev & 0xFFFF;
UpdateState(GPUSTATE_DONE);
// Since we marked done, we have to restore the context now before the next list runs.
if (currentList->started && currentList->context.IsValid()) {
gstate.Restore(currentList->context);
ReapplyGfxState();
// Don't restore the context again.
currentList->started = false;
}

if (currentList->interruptsEnabled && __GeTriggerInterrupt(currentList->id, currentList->pc, startingTicks + cyclesExecuted)) {
currentList->pendingInterrupt = true;
} else {
currentList->state = PSP_GE_DL_STATE_COMPLETED;
currentList->waitTicks = startingTicks + cyclesExecuted;
busyTicks = std::max(busyTicks, currentList->waitTicks);
__GeTriggerSync(GPU_SYNC_LIST, currentList->id, currentList->waitTicks);
if (currentList->started && currentList->context.IsValid()) {
gstate.Restore(currentList->context);
ReapplyGfxState();
}
}
break;
}
Expand Down

0 comments on commit f2ad475

Please sign in to comment.