diff options
Diffstat (limited to 'src/video_core/gpu_thread.h')
| -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 | |||
| 70 | /// Struct used to synchronize the GPU thread | 70 | /// Struct used to synchronize the GPU thread |
| 71 | struct SynchState final { | 71 | struct SynchState final { |
| 72 | std::atomic<bool> is_running{true}; | 72 | std::atomic<bool> is_running{true}; |
| 73 | std::atomic<bool> is_idle{true}; | ||
| 73 | std::condition_variable signal_condition; | 74 | std::condition_variable signal_condition; |
| 74 | std::mutex signal_mutex; | 75 | std::mutex signal_mutex; |
| 75 | std::condition_variable idle_condition; | 76 | std::condition_variable idle_condition; |
| @@ -84,9 +85,9 @@ struct SynchState final { | |||
| 84 | CommandQueue* push_queue{&command_queues[0]}; | 85 | CommandQueue* push_queue{&command_queues[0]}; |
| 85 | CommandQueue* pop_queue{&command_queues[1]}; | 86 | CommandQueue* pop_queue{&command_queues[1]}; |
| 86 | 87 | ||
| 87 | /// Returns true if the GPU thread should be idle, meaning there are no commands to process | 88 | void UpdateIdleState() { |
| 88 | bool IsIdle() const { | 89 | std::lock_guard<std::mutex> lock{idle_mutex}; |
| 89 | return command_queues[0].empty() && command_queues[1].empty(); | 90 | is_idle = command_queues[0].empty() && command_queues[1].empty(); |
| 90 | } | 91 | } |
| 91 | }; | 92 | }; |
| 92 | 93 | ||