GPU/SW: Replace event with semaphore

This commit is contained in:
Connor McLaughlin 2022-07-30 21:49:56 +10:00
parent 89659db7ee
commit eb166220b1
2 changed files with 3 additions and 4 deletions

View file

@ -200,8 +200,7 @@ void GPUBackend::Sync(bool allow_sleep)
PushCommand(cmd); PushCommand(cmd);
WakeGPUThread(); WakeGPUThread();
m_sync_event.Wait(); m_sync_semaphore.Wait();
m_sync_event.Reset();
} }
void GPUBackend::RunGPULoop() void GPUBackend::RunGPULoop()
@ -252,7 +251,7 @@ void GPUBackend::RunGPULoop()
case GPUBackendCommandType::Sync: case GPUBackendCommandType::Sync:
{ {
DebugAssert(read_ptr == write_ptr); DebugAssert(read_ptr == write_ptr);
m_sync_event.Signal(); m_sync_semaphore.Post();
allow_sleep = static_cast<const GPUBackendSyncCommand*>(cmd)->allow_sleep; allow_sleep = static_cast<const GPUBackendSyncCommand*>(cmd)->allow_sleep;
} }
break; break;

View file

@ -66,7 +66,7 @@ protected:
Common::Rectangle<u32> m_drawing_area{}; Common::Rectangle<u32> m_drawing_area{};
Common::Event m_sync_event; Threading::KernelSemaphore m_sync_semaphore;
std::atomic_bool m_gpu_thread_sleeping{false}; std::atomic_bool m_gpu_thread_sleeping{false};
std::atomic_bool m_gpu_loop_done{false}; std::atomic_bool m_gpu_loop_done{false};
Threading::Thread m_gpu_thread; Threading::Thread m_gpu_thread;