Revert "Revert "vk_scheduler: wait for command processing to complete""

* No longer needed after async present and causes sync issues during swapchain recreation

This reverts commit 0381081c5d.
This commit is contained in:
GPUCode
2023-02-25 17:13:03 +02:00
parent c00bdc4214
commit d1ac33b18b
2 changed files with 4 additions and 9 deletions

View File

@ -562,13 +562,6 @@ bool RasterizerVulkan::Draw(bool accelerate, bool is_indexed) {
// Mark framebuffer surfaces as dirty // Mark framebuffer surfaces as dirty
res_cache.InvalidateRenderTargets(framebuffer); res_cache.InvalidateRenderTargets(framebuffer);
static int counter = 20;
counter--;
if (counter == 0) {
scheduler.DispatchWork();
counter = 20;
}
return succeeded; return succeeded;
} }

View File

@ -83,6 +83,7 @@ void Scheduler::WorkerThread(std::stop_token stop_token) {
Common::SetCurrentThreadName("VulkanWorker"); Common::SetCurrentThreadName("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()) {
@ -94,9 +95,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) {
AllocateWorkerCommandBuffers(); AllocateWorkerCommandBuffers();
} }