vk_scheduler: Prevent DispatchWork stalls
* Now that Finish no longer depends on the queue being empty of not we can move the chunk execution out of the work_mutex scope
This commit is contained in:
@@ -72,7 +72,6 @@ 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()) {
|
||||||
@@ -84,10 +83,9 @@ 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();
|
||||||
}
|
}
|
||||||
|
@@ -213,7 +213,6 @@ private:
|
|||||||
std::mutex work_mutex;
|
std::mutex work_mutex;
|
||||||
std::mutex queue_mutex;
|
std::mutex queue_mutex;
|
||||||
std::condition_variable_any work_cv;
|
std::condition_variable_any work_cv;
|
||||||
std::condition_variable wait_cv;
|
|
||||||
std::jthread worker_thread;
|
std::jthread worker_thread;
|
||||||
bool use_worker_thread;
|
bool use_worker_thread;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user