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 ...@@ -49,6 +49,7 @@ namespace sw
constants = *Pointer<Pointer<Byte>>(data + OFFSET(DrawData,constants)); constants = *Pointer<Pointer<Byte>>(data + OFFSET(DrawData,constants));
occlusion = 0; occlusion = 0;
int clusterCount = Renderer::getClusterCount();
Do Do
{ {
...@@ -290,6 +291,8 @@ namespace sw ...@@ -290,6 +291,8 @@ namespace sw
} }
} }
int clusterCount = Renderer::getClusterCount();
for(int index = 0; index < RENDERTARGETS; index++) for(int index = 0; index < RENDERTARGETS; index++)
{ {
if(state.colorWriteActive(index)) if(state.colorWriteActive(index))
......
...@@ -63,8 +63,8 @@ namespace sw ...@@ -63,8 +63,8 @@ namespace sw
int batchSize = 128; int batchSize = 128;
int threadCount = 1; int threadCount = 1;
int unitCount = 1; AtomicInt Renderer::unitCount = 1;
int clusterCount = 1; AtomicInt Renderer::clusterCount = 1;
TranscendentalPrecision logPrecision = ACCURATE; TranscendentalPrecision logPrecision = ACCURATE;
TranscendentalPrecision expPrecision = ACCURATE; TranscendentalPrecision expPrecision = ACCURATE;
......
...@@ -39,8 +39,6 @@ namespace sw ...@@ -39,8 +39,6 @@ namespace sw
extern int batchSize; extern int batchSize;
extern int threadCount; extern int threadCount;
extern int unitCount;
extern int clusterCount;
enum TranscendentalPrecision enum TranscendentalPrecision
{ {
...@@ -405,6 +403,8 @@ namespace sw ...@@ -405,6 +403,8 @@ namespace sw
void resetTimers(); void resetTimers();
#endif #endif
static int getClusterCount() { return clusterCount; }
private: private:
static void threadFunction(void *parameters); static void threadFunction(void *parameters);
void threadLoop(int threadIndex); void threadLoop(int threadIndex);
...@@ -468,8 +468,11 @@ namespace sw ...@@ -468,8 +468,11 @@ namespace sw
AtomicInt nextDraw; AtomicInt nextDraw;
Task taskQueue[32]; Task taskQueue[32];
unsigned int qHead; AtomicInt qHead;
unsigned int qSize; AtomicInt qSize;
static AtomicInt unitCount;
static AtomicInt clusterCount;
MutexLock schedulerMutex; 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