summaryrefslogtreecommitdiffstats
path: root/source/compiler-core/slang-dxc-compiler.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2021-06-02 13:44:04 -0400
committerGitHub <noreply@github.com>2021-06-02 13:44:04 -0400
commit7e93e8164c74f61b61ea66f215304abdf453965b (patch)
treecf722f2e16a2cf2b2c2dc77eec38d568730d8546 /source/compiler-core/slang-dxc-compiler.cpp
parentb699a36444a03a6f7b312e805de31395a2d2ff9c (diff)
Downstream compiler location fix. (#1866)
* #include an absolute path didn't work - because paths were taken to always be relative. * Move logic to determine how to load a downstream shared library to DownstreamCompilerUtil::loadSharedLibrary. Handle if the given path is directory or a file. * Improve comment. * Special handling for a downstream compiler loading SharedLibrary detection - take into account filename may be different. * Handle cases if path is set but paths can't be determined. * Fix typo. Co-authored-by: T. Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'source/compiler-core/slang-dxc-compiler.cpp')
-rw-r--r--source/compiler-core/slang-dxc-compiler.cpp27
1 files changed, 3 insertions, 24 deletions
diff --git a/source/compiler-core/slang-dxc-compiler.cpp b/source/compiler-core/slang-dxc-compiler.cpp
index 0b46bd09e..f5db290b1 100644
--- a/source/compiler-core/slang-dxc-compiler.cpp
+++ b/source/compiler-core/slang-dxc-compiler.cpp
@@ -397,30 +397,9 @@ SlangResult DXCDownstreamCompiler::disassemble(SlangCompileTarget sourceBlobTarg
{
ComPtr<ISlangSharedLibrary> library;
- // If the user supplies a path to their preferred version of DXC
- // we just use this.
- if (path.getLength() != 0)
- {
- // We *assume* path is the path to d3dcompiler.
- ComPtr<ISlangSharedLibrary> dxil;
-
- // Attempt to load dxil from same path that d3dcompiler is located
- const String parentPath = Path::getParentDirectory(path);
- if (parentPath.getLength())
- {
- String dxilPath = Path::combine(parentPath, "dxil");
- // Try to load dxil along this path first
- // If it fails - then DXC may load from a different place and thats ok.
- loader->loadSharedLibrary(dxilPath.getBuffer(), dxil.writeRef());
- }
-
- SLANG_RETURN_ON_FAIL(loader->loadSharedLibrary(path.getBuffer(), library.writeRef()));
- }
- else
- {
- SLANG_RETURN_ON_FAIL(loader->loadSharedLibrary("dxcompiler", library.writeRef()));
- }
-
+ const char* dependentNames[] = {"dxil", nullptr } ;
+ SLANG_RETURN_ON_FAIL(DownstreamCompilerUtil::loadSharedLibrary(path, loader, dependentNames, "dxcompiler", library));
+
SLANG_ASSERT(library);
if (!library)
{