Skip to content
Permalink
Browse files

- Write out a warning if std::thread::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
  • Loading branch information...
dpjudas authored and madame-rachelle committed May 9, 2019
1 parent 9a1dab5 commit e2fc3f2fac5adc2453eeac803972f8f3de14cef6
Showing with 11 additions and 2 deletions.
  1. +1 −1 src/rendering/polyrenderer/poly_renderthread.cpp
  2. +10 −1 src/rendering/swrenderer/scene/r_scene.cpp
@@ -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;
@@ -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;

0 comments on commit e2fc3f2

Please sign in to comment.
You can’t perform that action at this time.