commit
627f409aec
@ -1343,7 +1343,6 @@ int ShInitialize()
|
|||||||
|
|
||||||
glslang::GetGlobalLock();
|
glslang::GetGlobalLock();
|
||||||
++NumberOfClients;
|
++NumberOfClients;
|
||||||
glslang::ReleaseGlobalLock();
|
|
||||||
|
|
||||||
if (PerProcessGPA == nullptr)
|
if (PerProcessGPA == nullptr)
|
||||||
PerProcessGPA = new TPoolAllocator();
|
PerProcessGPA = new TPoolAllocator();
|
||||||
@ -1353,6 +1352,7 @@ int ShInitialize()
|
|||||||
glslang::HlslScanContext::fillInKeywordMap();
|
glslang::HlslScanContext::fillInKeywordMap();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
glslang::ReleaseGlobalLock();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1415,9 +1415,10 @@ int ShFinalize()
|
|||||||
--NumberOfClients;
|
--NumberOfClients;
|
||||||
assert(NumberOfClients >= 0);
|
assert(NumberOfClients >= 0);
|
||||||
bool finalize = NumberOfClients == 0;
|
bool finalize = NumberOfClients == 0;
|
||||||
|
if (! finalize) {
|
||||||
glslang::ReleaseGlobalLock();
|
glslang::ReleaseGlobalLock();
|
||||||
if (! finalize)
|
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
for (int version = 0; version < VersionCount; ++version) {
|
for (int version = 0; version < VersionCount; ++version) {
|
||||||
for (int spvVersion = 0; spvVersion < SpvVersionCount; ++spvVersion) {
|
for (int spvVersion = 0; spvVersion < SpvVersionCount; ++spvVersion) {
|
||||||
@ -1455,6 +1456,7 @@ int ShFinalize()
|
|||||||
glslang::HlslScanContext::deleteKeywordMap();
|
glslang::HlslScanContext::deleteKeywordMap();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
glslang::ReleaseGlobalLock();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -172,7 +172,7 @@ namespace {
|
|||||||
pthread_mutex_t gMutex;
|
pthread_mutex_t gMutex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitGlobalLock()
|
static void InitMutex(void)
|
||||||
{
|
{
|
||||||
pthread_mutexattr_t mutexattr;
|
pthread_mutexattr_t mutexattr;
|
||||||
pthread_mutexattr_init(&mutexattr);
|
pthread_mutexattr_init(&mutexattr);
|
||||||
@ -180,6 +180,12 @@ void InitGlobalLock()
|
|||||||
pthread_mutex_init(&gMutex, &mutexattr);
|
pthread_mutex_init(&gMutex, &mutexattr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InitGlobalLock()
|
||||||
|
{
|
||||||
|
static pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||||
|
pthread_once(&once, InitMutex);
|
||||||
|
}
|
||||||
|
|
||||||
void GetGlobalLock()
|
void GetGlobalLock()
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&gMutex);
|
pthread_mutex_lock(&gMutex);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user