2
3
4
5
12 std::shared_ptr<ThreadModel> ThreadModel::m_ThreadModel =
nullptr;
14 ThreadModel::ThreadModel()
15 : m_CustomThreadPool(
nullptr)
16 , m_GameThreadPool(
nullptr)
17 , m_RHIThreadPool(
nullptr)
20 std::shared_ptr<ThreadModel> ThreadModel::Get()
26 m_ThreadModel = std::make_shared<ThreadModel>();
32 void ThreadModel::InitCustomThreadPool()
36 if (!m_CustomThreadPool)
38 m_CustomThreadPool = std::make_shared<ThreadPool>(
"CusT");
39 m_CustomThreadPool->SetMode(PoolMode::MODE_CACHED);
40 m_CustomThreadPool->Start(8);
44 void ThreadModel::InitGameThreadPool()
48 if (!m_GameThreadPool)
50 m_GameThreadPool = std::make_shared<ThreadPool>(
"GameT");
51 m_GameThreadPool->SetMode(PoolMode::MODE_FIXED);
52 m_GameThreadPool->Start(4);
53 m_GameThreadPool->Suspend();
57 void ThreadModel::InitRHIThreadPool(std::function<
void(std::shared_ptr<
VulkanCmdThreadPool>& ptr)> fn)
67 void ThreadModel::ShutDownCustomThreadPool()
71 m_CustomThreadPool =
nullptr;
74 void ThreadModel::ShutDownGameThreadPool()
78 m_GameThreadPool =
nullptr;
81 void ThreadModel::ShutDownRHIThreadPool()
85 m_RHIThreadPool =
nullptr;
88 void ThreadModel::ClearMainThreadTaskQueue()
92 m_MainThreadTasks.Clear();
95 void ThreadModel::ShutDownThreadModel()
99 ShutDownRHIThreadPool();
100 ShutDownGameThreadPool();
101 ShutDownCustomThreadPool();
102 ClearMainThreadTaskQueue();
#define SPICES_PROFILE_ZONE
Wrappers of RHI Thread Pool.