Skip to content

Commit 3cbff11

Browse files
jsmall-zzzTim Foley
and
Tim Foley
authored
Removed use of pthreads in glslang (shader-slang#1517)
* Try removing pthreads from glslang. * Update slang-binaries to use glslang that doesn't use pthreads. Co-authored-by: Tim Foley <tfoleyNV@users.noreply.github.com>
1 parent ec55ac4 commit 3cbff11

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

premake5.lua

+4-7
Original file line numberDiff line numberDiff line change
@@ -1010,8 +1010,8 @@ standardProject "slang-spirv-tools"
10101010
addSourceDir("external/spirv-tools/source/val")
10111011

10121012
filter { "system:linux or macosx" }
1013-
links { "dl", "pthread" }
1014-
buildoptions{"-fPIC", "-pthread"}
1013+
links { "dl"}
1014+
buildoptions{"-fPIC"}
10151015

10161016
--
10171017
-- The single most complicated part of our build is our custom version of glslang.
@@ -1048,7 +1048,6 @@ standardProject "slang-glslang"
10481048
addSourceDir("external/glslang/glslang/GenericCodeGen")
10491049
addSourceDir("external/glslang/glslang/MachineIndependent")
10501050
addSourceDir("external/glslang/glslang/MachineIndependent/preprocessor")
1051-
addSourceDir("external/glslang/glslang/OSDependent")
10521051
addSourceDir("external/glslang/OGLCompilersDLL")
10531052
addSourceDir("external/glslang/SPIRV")
10541053
addSourceDir("external/glslang/StandAlone")
@@ -1069,13 +1068,11 @@ standardProject "slang-glslang"
10691068
-- On Windows we need to add the platform-specific sources and then
10701069
-- remove the `main.cpp` file since it tries to define a `DllMain`
10711070
-- and we don't want the default glslang one.
1072-
addSourceDir( "external/glslang/glslang/OSDependent/Windows" )
10731071
removefiles { "external/glslang/glslang/OSDependent/Windows/main.cpp" }
10741072

10751073
filter { "system:linux or macosx" }
1076-
links { "dl", "pthread" }
1077-
addSourceDir("external/glslang/glslang/OSDependent/Unix")
1078-
buildoptions{"-fPIC", "-pthread"}
1074+
links { "dl" }
1075+
buildoptions{"-fPIC"}
10791076

10801077

10811078

source/slang-glslang/slang-glslang.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -588,3 +588,24 @@ int glslang_compile(glslang_CompileRequest_1_0* inRequest)
588588
request.set(*inRequest);
589589
return glslang_compile_1_1(&request);
590590
}
591+
592+
static std::mutex g_globalMutex;
593+
594+
namespace glslang {
595+
596+
void InitGlobalLock()
597+
{
598+
599+
}
600+
601+
void GetGlobalLock()
602+
{
603+
g_globalMutex.lock();
604+
}
605+
606+
void ReleaseGlobalLock()
607+
{
608+
g_globalMutex.unlock();
609+
}
610+
611+
} // namespace glslang

0 commit comments

Comments
 (0)