Only support main thread rendering in debug builds.
Rendering on the main thread can cause segmentation faults on Windows
due to uncommitted stack memory, since Subzero does not currently call
__chkstk. In practice this would have mainly been an issue on VMs with
a single virtual CPU.
Bug swiftshader:25
Change-Id: Ic3be7e5a41ef09b7e056d3c3df2983c225101fe4
Reviewed-on: https://swiftshader-review.googlesource.com/8934
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/Renderer/Renderer.cpp b/src/Renderer/Renderer.cpp
index d69fcac..a8f6032 100644
--- a/src/Renderer/Renderer.cpp
+++ b/src/Renderer/Renderer.cpp
@@ -657,7 +657,16 @@
nextDraw++;
schedulerMutex.unlock();
- if(threadCount > 1)
+ #ifndef NDEBUG
+ if(threadCount == 1) // Use main thread for draw execution
+ {
+ threadsAwake = 1;
+ task[0].type = Task::RESUME;
+
+ taskLoop(0);
+ }
+ else
+ #endif
{
if(!threadsAwake)
{
@@ -669,13 +678,6 @@
resume[0]->signal();
}
}
- else // Use main thread for draw execution
- {
- threadsAwake = 1;
- task[0].type = Task::RESUME;
-
- taskLoop(0);
- }
}
}