Commit aa8239a5 by Alexis Hetu Committed by Alexis Hétu

More data races fixed

A few more variables were causing possible data races, so they were changed to AtomicInt variables. Change-Id: Icf233482528e086fc58f6919232ab2e3f0784689 Reviewed-on: https://swiftshader-review.googlesource.com/12368Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 6b164c33
......@@ -49,6 +49,7 @@ namespace sw
constants = *Pointer<Pointer<Byte>>(data + OFFSET(DrawData,constants));
occlusion = 0;
int clusterCount = Renderer::getClusterCount();
Do
{
......@@ -290,6 +291,8 @@ namespace sw
}
}
int clusterCount = Renderer::getClusterCount();
for(int index = 0; index < RENDERTARGETS; index++)
{
if(state.colorWriteActive(index))
......
......@@ -63,8 +63,8 @@ namespace sw
int batchSize = 128;
int threadCount = 1;
int unitCount = 1;
int clusterCount = 1;
AtomicInt Renderer::unitCount = 1;
AtomicInt Renderer::clusterCount = 1;
TranscendentalPrecision logPrecision = ACCURATE;
TranscendentalPrecision expPrecision = ACCURATE;
......
......@@ -39,8 +39,6 @@ namespace sw
extern int batchSize;
extern int threadCount;
extern int unitCount;
extern int clusterCount;
enum TranscendentalPrecision
{
......@@ -405,6 +403,8 @@ namespace sw
void resetTimers();
#endif
static int getClusterCount() { return clusterCount; }
private:
static void threadFunction(void *parameters);
void threadLoop(int threadIndex);
......@@ -468,8 +468,11 @@ namespace sw
AtomicInt nextDraw;
Task taskQueue[32];
unsigned int qHead;
unsigned int qSize;
AtomicInt qHead;
AtomicInt qSize;
static AtomicInt unitCount;
static AtomicInt clusterCount;
MutexLock schedulerMutex;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment