- Write out a warning if std:🧵:hardware_concurrency returns zero.

- If the number of cores cannot be determined, turn of multithreading in the software renderer as it is most likely a low end system
This commit is contained in:
Magnus Norddahl 2019-05-09 15:57:23 +02:00
parent 7e998c2261
commit 7727263599
2 changed files with 11 additions and 2 deletions

View file

@ -151,7 +151,7 @@ void PolyRenderThreads::RenderThreadSlices(int totalcount, std::function<void(Po
int numThreads = std::thread::hardware_concurrency();
if (numThreads == 0)
numThreads = 4;
numThreads = 1;
if (r_scene_multithreaded == 0 || r_multithreaded == 0)
numThreads = 1;

View file

@ -200,7 +200,16 @@ namespace swrenderer
{
int numThreads = std::thread::hardware_concurrency();
if (numThreads == 0)
numThreads = 4;
{
static bool firstCall = true;
if (firstCall)
{
firstCall = false;
Printf("Warning: Unable to determine number of CPU cores/threads for this computer. To improve performance, please type 'r_multithreaded x' in the console, where x is the number of threads to use.\n");
}
numThreads = 1;
}
if (r_scene_multithreaded == 0 || r_multithreaded == 0)
numThreads = 1;