diff options
author | bunnei <bunneidev@gmail.com> | 2019-02-09 17:37:11 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2019-03-07 03:48:57 +0100 |
commit | 84ad81ee6798ece6c66016c4581b5fe57ce7b20e (patch) | |
tree | a3b4940e25c43a743237e99afa75edc3d3633f67 /src/video_core/gpu_thread.h | |
parent | gpu_thread: (HACK) Ignore flush on FlushAndInvalidateRegion. (diff) | |
download | yuzu-84ad81ee6798ece6c66016c4581b5fe57ce7b20e.tar yuzu-84ad81ee6798ece6c66016c4581b5fe57ce7b20e.tar.gz yuzu-84ad81ee6798ece6c66016c4581b5fe57ce7b20e.tar.bz2 yuzu-84ad81ee6798ece6c66016c4581b5fe57ce7b20e.tar.lz yuzu-84ad81ee6798ece6c66016c4581b5fe57ce7b20e.tar.xz yuzu-84ad81ee6798ece6c66016c4581b5fe57ce7b20e.tar.zst yuzu-84ad81ee6798ece6c66016c4581b5fe57ce7b20e.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/gpu_thread.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/video_core/gpu_thread.h b/src/video_core/gpu_thread.h index ad9f9462b..2ad8214cc 100644 --- a/src/video_core/gpu_thread.h +++ b/src/video_core/gpu_thread.h @@ -70,6 +70,7 @@ using CommandData = std::variant<SubmitListCommand, SwapBuffersCommand, FlushReg /// Struct used to synchronize the GPU thread struct SynchState final { std::atomic<bool> is_running{true}; + std::atomic<bool> is_idle{true}; std::condition_variable signal_condition; std::mutex signal_mutex; std::condition_variable idle_condition; @@ -84,9 +85,9 @@ struct SynchState final { CommandQueue* push_queue{&command_queues[0]}; CommandQueue* pop_queue{&command_queues[1]}; - /// Returns true if the GPU thread should be idle, meaning there are no commands to process - bool IsIdle() const { - return command_queues[0].empty() && command_queues[1].empty(); + void UpdateIdleState() { + std::lock_guard<std::mutex> lock{idle_mutex}; + is_idle = command_queues[0].empty() && command_queues[1].empty(); } }; |