Use a symbolic constant for the default thread count.
Bug 23073037
Change-Id: I7da215ceff23f9a5c8188d3566a7c478b9489117
Reviewed-on: https://swiftshader-review.googlesource.com/3841
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
diff --git a/src/Main/Config.hpp b/src/Main/Config.hpp
index 844ebae..6cb89a5 100644
--- a/src/Main/Config.hpp
+++ b/src/Main/Config.hpp
@@ -16,12 +16,20 @@
#define PERF_HUD 0 // Display time spent on vertex, setup and pixel processing for each thread
#define PERF_PROFILE 0 // Profile various pipeline stages and display the timing in SwiftConfig
+
#if defined(_WIN32)
#define S3TC_SUPPORT 1
#else
#define S3TC_SUPPORT 0
#endif
+// Worker thread count when not set by SwiftConfig
+// 0 = process affinity count (recommended)
+// 1 = rendering on main thread (no worker threads), useful for debugging
+#ifndef DEFAULT_THREAD_COUNT
+#define DEFAULT_THREAD_COUNT 0
+#endif
+
enum
{
PERF_PIXEL,
diff --git a/src/Main/SwiftConfig.cpp b/src/Main/SwiftConfig.cpp
index a103c69..d80e344 100644
--- a/src/Main/SwiftConfig.cpp
+++ b/src/Main/SwiftConfig.cpp
@@ -726,7 +726,7 @@
config.perspectiveCorrection = ini.getBoolean("Quality", "PerspectiveCorrection", true);
config.transcendentalPrecision = ini.getInteger("Quality", "TranscendentalPrecision", 2);
config.transparencyAntialiasing = ini.getInteger("Quality", "TransparencyAntialiasing", 0);
- config.threadCount = ini.getInteger("Processor", "ThreadCount", 0);
+ config.threadCount = ini.getInteger("Processor", "ThreadCount", DEFAULT_THREAD_COUNT);
config.enableSSE = ini.getBoolean("Processor", "EnableSSE", true);
config.enableSSE2 = ini.getBoolean("Processor", "EnableSSE2", true);
config.enableSSE3 = ini.getBoolean("Processor", "EnableSSE3", true);