Replace DrainAndBlockCompileThreads with StopThreads, and same for resuming.

This commit is contained in:
Henrik Rydgård
2024-01-22 11:06:50 +01:00
parent 0e708367b5
commit 0bf7a98aff
3 changed files with 7 additions and 26 deletions
-17
View File
@@ -408,23 +408,6 @@ void VulkanRenderManager::StopThreads() {
_dbg_assert_(steps_.empty());
}
void VulkanRenderManager::DrainAndBlockCompileQueue() {
runCompileThread_ = false;
compileCond_.notify_all();
compileThread_.join();
_assert_(compileQueue_.empty());
// At this point, no more tasks can be queued to the threadpool. So wait for them all to go away.
CreateMultiPipelinesTask::WaitForAll();
}
void VulkanRenderManager::ReleaseCompileQueue() {
runCompileThread_ = true;
INFO_LOG(G3D, "Restarting Vulkan compiler thread");
compileThread_ = std::thread(&VulkanRenderManager::CompileThreadFunc, this);
}
void VulkanRenderManager::DestroyBackbuffers() {
StopThreads();
vulkan_->WaitUntilQueueIdle();
+3 -5
View File
@@ -529,8 +529,9 @@ public:
}
void ResetStats();
void DrainAndBlockCompileQueue();
void ReleaseCompileQueue();
void StartThreads();
void StopThreads();
private:
void EndCurRenderStep();
@@ -543,9 +544,6 @@ private:
// Bad for performance but sometimes necessary for synchronous CPU readbacks (screenshots and whatnot).
void FlushSync();
void StartThreads();
void StopThreads();
void PresentWaitThreadFunc();
void PollPresentTiming();
+4 -4
View File
@@ -168,7 +168,7 @@ GPU_Vulkan::~GPU_Vulkan() {
if (draw_) {
VulkanRenderManager *rm = (VulkanRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
// This now also does a hard sync with the render thread, so that we can safely delete our pipeline layout below.
rm->DrainAndBlockCompileQueue();
rm->StopThreads();
}
SaveCache(shaderCachePath_);
@@ -185,7 +185,7 @@ GPU_Vulkan::~GPU_Vulkan() {
// other managers are deleted in ~GPUCommonHW.
if (draw_) {
VulkanRenderManager *rm = (VulkanRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
rm->ReleaseCompileQueue();
rm->StartThreads();
}
}
@@ -426,7 +426,7 @@ void GPU_Vulkan::DeviceLost() {
Draw::DrawContext *draw = draw_;
if (draw) {
VulkanRenderManager *rm = (VulkanRenderManager *)draw->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
rm->DrainAndBlockCompileQueue();
rm->StopThreads();
}
if (shaderCachePath_.Valid()) {
@@ -439,7 +439,7 @@ void GPU_Vulkan::DeviceLost() {
if (draw) {
VulkanRenderManager *rm = (VulkanRenderManager *)draw->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
rm->ReleaseCompileQueue();
rm->StartThreads();
}
}