Fix SyncThread() not syncing during last event.

This commit is contained in:
Unknown W. Brackets 2013-08-09 22:40:51 -07:00
parent 5e363bcbd2
commit a80a7690c8
2 changed files with 8 additions and 0 deletions

View file

@ -584,6 +584,9 @@ void GPUCommon::RunEventsUntil(u64 globalticks) {
globalticks = 0;
break;
case GPU_EVENT_SYNC_THREAD:
break;
default:
ProcessEvent(ev);
}
@ -613,6 +616,10 @@ void GPUCommon::SyncThread() {
return;
}
// It could be that we are *currently* processing the last event.
// The events queue will be empty (HasEvents() = false), but it's not done.
// So we schedule a nothing event and wait for that to finish.
ScheduleEvent(GPU_EVENT_SYNC_THREAD);
while (HasEvents() && coreState == CORE_RUNNING) {
eventsDrain.wait_for(eventsDrainLock, 1);
};

View file

@ -149,6 +149,7 @@ enum GPUEventType {
GPU_EVENT_REAPPLY_GFX_STATE,
GPU_EVENT_INVALIDATE_CACHE,
GPU_EVENT_FINISH_EVENT_LOOP,
GPU_EVENT_SYNC_THREAD,
};
struct GPUEvent {