mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Vulkan: Make WaitForPipelines wait for queued compiles too
Pipelines still in the compile queue weren't in flight yet, so the shader cache load could stop waiting (and the spinner) early. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
39b6cc0c0c
commit
4bfa4e14ec
2 files changed
+18
No files matched your search
@@ -581,6 +581,7 @@ void VulkanRenderManager::CompileThreadFunc() {
|
||||
}
|
||||
toCompile = std::move(compileQueue_);
|
||||
compileQueue_.clear();
|
||||
compileScheduling_ = true;
|
||||
if (!runCompileThread_) {
|
||||
exitAfterCompile = true;
|
||||
}
|
||||
@@ -626,6 +627,11 @@ void VulkanRenderManager::CompileThreadFunc() {
|
||||
g_threadManager.EnqueueTask(task);
|
||||
}
|
||||
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(compileQueueMutex_);
|
||||
compileScheduling_ = false;
|
||||
}
|
||||
|
||||
if (exitAfterCompile) {
|
||||
break;
|
||||
}
|
||||
@@ -904,6 +910,16 @@ void VulkanRenderManager::ReportBadStateForDraw() {
|
||||
}
|
||||
|
||||
int VulkanRenderManager::WaitForPipelines() {
|
||||
// Pipelines still in the queue, or taken off it but not yet made into tasks, aren't in flight yet.
|
||||
while (true) {
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(compileQueueMutex_);
|
||||
if (compileQueue_.empty() && !compileScheduling_) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
sleep_ms(2, "pipeline-queue-wait");
|
||||
}
|
||||
return CreateMultiPipelinesTask::WaitForAll();
|
||||
}
|
||||
|
||||
|
||||
@@ -628,6 +628,8 @@ private:
|
||||
std::condition_variable compileCond_;
|
||||
std::mutex compileQueueMutex_;
|
||||
std::vector<CompileQueueEntry> compileQueue_;
|
||||
// Set while the compile thread turns a batch it took off compileQueue_ into tasks.
|
||||
bool compileScheduling_ = false;
|
||||
|
||||
// Thread for measuring presentation delay.
|
||||
std::thread presentWaitThread_;
|
||||
|
||||
Reference in new issue
Block a user