diff options
| author | 2023-03-19 03:19:25 -0400 | |
|---|---|---|
| committer | 2023-03-21 19:17:32 -0400 | |
| commit | 306840a5808cae10bf5d91e4b6e8a91cd619386b (patch) | |
| tree | 22d42022abbf8ab522ee046919920135d86be42c /src/video_core/gpu_thread.cpp | |
| parent | Merge pull request #9970 from bunnei/string-util-view (diff) | |
| download | yuzu-306840a5808cae10bf5d91e4b6e8a91cd619386b.tar.gz yuzu-306840a5808cae10bf5d91e4b6e8a91cd619386b.tar.xz yuzu-306840a5808cae10bf5d91e4b6e8a91cd619386b.zip | |
bounded_threadsafe_queue: Use simplified impl of bounded queue
Provides a simplified SPSC, MPSC, and MPMC bounded queue implementation using mutexes.
Diffstat (limited to 'src/video_core/gpu_thread.cpp')
| -rw-r--r-- | src/video_core/gpu_thread.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp index f52f9e28f..469a59cf9 100644 --- a/src/video_core/gpu_thread.cpp +++ b/src/video_core/gpu_thread.cpp | |||
| @@ -31,9 +31,10 @@ static void RunThread(std::stop_token stop_token, Core::System& system, | |||
| 31 | auto current_context = context.Acquire(); | 31 | auto current_context = context.Acquire(); |
| 32 | VideoCore::RasterizerInterface* const rasterizer = renderer.ReadRasterizer(); | 32 | VideoCore::RasterizerInterface* const rasterizer = renderer.ReadRasterizer(); |
| 33 | 33 | ||
| 34 | CommandDataContainer next; | ||
| 35 | |||
| 34 | while (!stop_token.stop_requested()) { | 36 | while (!stop_token.stop_requested()) { |
| 35 | CommandDataContainer next; | 37 | state.queue.PopWait(next, stop_token); |
| 36 | state.queue.Pop(next, stop_token); | ||
| 37 | if (stop_token.stop_requested()) { | 38 | if (stop_token.stop_requested()) { |
| 38 | break; | 39 | break; |
| 39 | } | 40 | } |
| @@ -117,7 +118,7 @@ u64 ThreadManager::PushCommand(CommandData&& command_data, bool block) { | |||
| 117 | 118 | ||
| 118 | std::unique_lock lk(state.write_lock); | 119 | std::unique_lock lk(state.write_lock); |
| 119 | const u64 fence{++state.last_fence}; | 120 | const u64 fence{++state.last_fence}; |
| 120 | state.queue.Push(CommandDataContainer(std::move(command_data), fence, block)); | 121 | state.queue.Push(std::move(command_data), fence, block); |
| 121 | 122 | ||
| 122 | if (block) { | 123 | if (block) { |
| 123 | Common::CondvarWait(state.cv, lk, thread.get_stop_token(), [this, fence] { | 124 | Common::CondvarWait(state.cv, lk, thread.get_stop_token(), [this, fence] { |