瀏覽代碼

vk_scheduler: wait for command processing to complete

Liam 3 年之前
父節點
當前提交
7969d4d5de
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      src/video_core/renderer_vulkan/vk_scheduler.cpp

+ 4 - 2
src/video_core/renderer_vulkan/vk_scheduler.cpp

@@ -139,6 +139,7 @@ void Scheduler::WorkerThread(std::stop_token stop_token) {
     Common::SetCurrentThreadName("yuzu:VulkanWorker");
     Common::SetCurrentThreadName("yuzu:VulkanWorker");
     do {
     do {
         std::unique_ptr<CommandChunk> work;
         std::unique_ptr<CommandChunk> work;
+        bool has_submit{false};
         {
         {
             std::unique_lock lock{work_mutex};
             std::unique_lock lock{work_mutex};
             if (work_queue.empty()) {
             if (work_queue.empty()) {
@@ -150,9 +151,10 @@ void Scheduler::WorkerThread(std::stop_token stop_token) {
             }
             }
             work = std::move(work_queue.front());
             work = std::move(work_queue.front());
             work_queue.pop();
             work_queue.pop();
+
+            has_submit = work->HasSubmit();
+            work->ExecuteAll(current_cmdbuf);
         }
         }
-        const bool has_submit = work->HasSubmit();
-        work->ExecuteAll(current_cmdbuf);
         if (has_submit) {
         if (has_submit) {
             AllocateWorkerCommandBuffer();
             AllocateWorkerCommandBuffer();
         }
         }