Dynamically create pipeline threads depending on hardware concurrency.

This commit is contained in:
Skyth 2024-11-28 00:23:59 +03:00
parent c34198e48a
commit 2f343bcab7

View file

@ -4453,18 +4453,16 @@ static void PipelineCompilerThread()
} }
} }
static std::thread g_pipelineCompilerThread(PipelineCompilerThread); static std::vector<std::unique_ptr<std::thread>> g_pipelineCompilerThreads = []()
static std::thread g_pipelineCompilerThread1(PipelineCompilerThread); {
static std::thread g_pipelineCompilerThread2(PipelineCompilerThread); size_t threadCount = std::max(2u, (std::thread::hardware_concurrency() * 2) / 3);
static std::thread g_pipelineCompilerThread3(PipelineCompilerThread);
static std::thread g_pipelineCompilerThread4(PipelineCompilerThread); std::vector<std::unique_ptr<std::thread>> threads(threadCount);
static std::thread g_pipelineCompilerThread5(PipelineCompilerThread); for (auto& thread : threads)
static std::thread g_pipelineCompilerThread6(PipelineCompilerThread); thread = std::make_unique<std::thread>(PipelineCompilerThread);
static std::thread g_pipelineCompilerThread7(PipelineCompilerThread);
static std::thread g_pipelineCompilerThread8(PipelineCompilerThread); return threads;
static std::thread g_pipelineCompilerThread9(PipelineCompilerThread); }();
static std::thread g_pipelineCompilerThread10(PipelineCompilerThread);
static std::thread g_pipelineCompilerThread11(PipelineCompilerThread);
static constexpr uint32_t MODEL_DATA_VFTABLE = 0x82073A44; static constexpr uint32_t MODEL_DATA_VFTABLE = 0x82073A44;
static constexpr uint32_t TERRAIN_MODEL_DATA_VFTABLE = 0x8211D25C; static constexpr uint32_t TERRAIN_MODEL_DATA_VFTABLE = 0x8211D25C;