Simplify ProcessDLQueue() slightly.

This commit is contained in:
Unknown W. Brackets 2013-08-04 16:31:11 -07:00
parent b17b23f1f2
commit 3aa2db9a8e
2 changed files with 20 additions and 18 deletions

View file

@ -517,34 +517,35 @@ inline void GPUCommon::UpdateState(GPUState state)
downcount = 0;
}
bool GPUCommon::ProcessDLQueue()
{
int GPUCommon::GetNextListIndex() {
auto iter = dlQueue.begin();
if (iter != dlQueue.end()) {
return *iter;
} else {
return -1;
}
}
bool GPUCommon::ProcessDLQueue() {
startingTicks = CoreTiming::GetTicks();
cyclesExecuted = 0;
if (startingTicks < busyTicks)
{
if (startingTicks < busyTicks) {
DEBUG_LOG(HLE, "Can't execute a list yet, still busy for %lld ticks", busyTicks - startingTicks);
return false;
}
DisplayListQueue::iterator iter = dlQueue.begin();
while (iter != dlQueue.end())
{
DisplayList &l = dls[*iter];
DEBUG_LOG(G3D,"Okay, starting DL execution at %08x - stall = %08x", l.pc, l.stall);
if (!InterpretList(l))
{
for (int listIndex = GetNextListIndex(); listIndex != -1; listIndex = GetNextListIndex()) {
DisplayList &l = dls[listIndex];
DEBUG_LOG(G3D, "Okay, starting DL execution at %08x - stall = %08x", l.pc, l.stall);
if (!InterpretList(l)) {
return false;
}
else
{
//At the end, we can remove it from the queue and continue
dlQueue.erase(iter);
//this invalidated the iterator, let's fix it
iter = dlQueue.begin();
} else {
// At the end, we can remove it from the queue and continue.
dlQueue.erase(std::remove(dlQueue.begin(), dlQueue.end(), listIndex), dlQueue.end());
}
}
currentList = NULL;
drawCompleteTicks = startingTicks + cyclesExecuted;

View file

@ -38,6 +38,7 @@ protected:
void UpdateState(GPUState state);
void PopDLQueue();
void CheckDrawSync();
int GetNextListIndex();
typedef std::list<int> DisplayListQueue;