mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
Allow glslang global lock to be used during process teardown
* During capture we may have to shutdown glslang from inside a global destructor, we need to ensure the lock is still valid.
This commit is contained in:
@@ -83,7 +83,11 @@ int NumberOfClients = 0;
|
||||
|
||||
// global initialization lock
|
||||
#ifndef DISABLE_THREAD_SUPPORT
|
||||
std::mutex init_lock;
|
||||
std::mutex &init_lock()
|
||||
{
|
||||
std::mutex *lock = new std::mutex;
|
||||
return *lock;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -430,7 +434,7 @@ bool SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& sp
|
||||
|
||||
// Make sure only one thread tries to do this at a time
|
||||
#ifndef DISABLE_THREAD_SUPPORT
|
||||
const std::lock_guard<std::mutex> lock(init_lock);
|
||||
const std::lock_guard<std::mutex> lock(init_lock());
|
||||
#endif
|
||||
|
||||
// See if it's already been done for this version/profile combination
|
||||
@@ -1333,7 +1337,7 @@ bool CompileDeferred(
|
||||
int ShInitialize()
|
||||
{
|
||||
#ifndef DISABLE_THREAD_SUPPORT
|
||||
const std::lock_guard<std::mutex> lock(init_lock);
|
||||
const std::lock_guard<std::mutex> lock(init_lock());
|
||||
#endif
|
||||
++NumberOfClients;
|
||||
|
||||
@@ -1390,7 +1394,7 @@ void ShDestruct(ShHandle handle)
|
||||
int ShFinalize()
|
||||
{
|
||||
#ifndef DISABLE_THREAD_SUPPORT
|
||||
const std::lock_guard<std::mutex> lock(init_lock);
|
||||
const std::lock_guard<std::mutex> lock(init_lock());
|
||||
#endif
|
||||
--NumberOfClients;
|
||||
assert(NumberOfClients >= 0);
|
||||
|
||||
Reference in New Issue
Block a user