diff options
| author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-04-26 22:11:31 -0300 |
|---|---|---|
| committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-22 21:51:29 -0400 |
| commit | 53acdda772a8b7650c46ba9d998119b8c8e30844 (patch) | |
| tree | 5f98a9a19093704513fffd17dc7326cdbf5e6f91 /src/video_core/renderer_vulkan/vk_scheduler.h | |
| parent | c5425b38c1a4d7eae270780d8b3ba66231015038 (diff) | |
vk_scheduler: Allow command submission on worker thread
This changes how Scheduler::Flush works. It queues the current command
buffer to be sent to the GPU but does not do it immediately. The Vulkan
worker thread takes care of that. Users will have to use
Scheduler::Flush + Scheduler::WaitWorker to get the previous behavior.
Scheduler::Finish is unchanged.
To avoid waiting on work never queued, Scheduler::Wait sends the current
command buffer if that's what the caller wants to wait.
Diffstat (limited to 'src/video_core/renderer_vulkan/vk_scheduler.h')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_scheduler.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/vk_scheduler.h b/src/video_core/renderer_vulkan/vk_scheduler.h index a40bb8bcd..40215c4c5 100644 --- a/src/video_core/renderer_vulkan/vk_scheduler.h +++ b/src/video_core/renderer_vulkan/vk_scheduler.h @@ -86,6 +86,10 @@ public: /// Waits for the given tick to trigger on the GPU. void Wait(u64 tick) { + if (tick >= master_semaphore->CurrentTick()) { + // Make sure we are not waiting for the current tick without signalling + Flush(); + } master_semaphore->Wait(tick); } @@ -155,15 +159,24 @@ private: return true; } + void MarkSubmit() { + submit = true; + } + bool Empty() const { return command_offset == 0; } + bool HasSubmit() const { + return submit; + } + private: Command* first = nullptr; Command* last = nullptr; size_t command_offset = 0; + bool submit = false; alignas(std::max_align_t) std::array<u8, 0x8000> data{}; }; @@ -176,6 +189,8 @@ private: void WorkerThread(); + void AllocateWorkerCommandBuffer(); + void SubmitExecution(VkSemaphore semaphore); void AllocateNewContext(); |
