diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2023-04-14 11:59:17 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-14 11:59:17 +0800 |
| commit | 5a629b3ccd801a1f0647e971d01481c55d3381c2 (patch) | |
| tree | a671f7d75f10afd1f43a06351389426bf3ba91c4 /source/core | |
| parent | 3bbac5f16e9dd47acd2132c0bb2a43393831c450 (diff) | |
Enable SLANG_ENABLE_DXIL_SUPPORT on non-Windows platforms (#2750)
* Enable SLANG_ENABLE_DXIL_SUPPORT on non-Windows platforms
This currently grabs the DXC headers from the system, rather than from external/dxc
We should make this consistent by either pulling in the Windows adapter from DXC into external/dxc or by making the Windows builds use <dxc/dxcapi.h>
* Update dxcapi and add DXC's WinAdapter
* Use our copy of dxcapi.h for non-windows DXC usage
* Only set -fms-extensions where necessary
* Work around dxc dlclose bug
* Neaten and comment dxc-compiler.cpp
Diffstat (limited to 'source/core')
| -rw-r--r-- | source/core/slang-platform.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/core/slang-platform.cpp b/source/core/slang-platform.cpp index dc2d563df..bb612932c 100644 --- a/source/core/slang-platform.cpp +++ b/source/core/slang-platform.cpp @@ -177,9 +177,14 @@ SLANG_COMPILE_TIME_ASSERT(E_OUTOFMEMORY == SLANG_E_OUT_OF_MEMORY); /* static */SlangResult SharedLibrary::loadWithPlatformPath(char const* platformFileName, Handle& handleOut) { handleOut = nullptr; + const auto dxcName = "libdxcompiler"; + const bool isDXC = strncmp(platformFileName, dxcName, strlen(dxcName)) == 0; if (strlen(platformFileName) == 0) platformFileName = nullptr; - void *h = dlopen(platformFileName, RTLD_NOW | RTLD_GLOBAL); + // Work around https://github.com/microsoft/DirectXShaderCompiler/issues/5119 + // libdxcompiler.so invokes UB on dlclose + const auto mode = RTLD_NOW | RTLD_GLOBAL | (isDXC ? RTLD_NODELETE : 0); + void *h = dlopen(platformFileName, mode); if (!h) { #if 0 |
