summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-08-19 15:27:27 -0400
committerGitHub <noreply@github.com>2019-08-19 15:27:27 -0400
commitf390351fcc258826cb4f8cb81d85db6982498ec6 (patch)
treea501866f68a073cd245831c0cc12f83c5c302f01
parentdc6d0417b137c8ecdcb3b99b7624358bba7fefa8 (diff)
Change handling of paths for backends via replacing the ISlangSharedLibrary mechansim. Use the m_passThroughPaths as set on the Session via the IGlobalSession interface. (#1025)
-rw-r--r--source/core/slang-shared-library.h2
-rw-r--r--source/slang/slang-options.cpp53
2 files changed, 19 insertions, 36 deletions
diff --git a/source/core/slang-shared-library.h b/source/core/slang-shared-library.h
index e48162ebd..675ee5cae 100644
--- a/source/core/slang-shared-library.h
+++ b/source/core/slang-shared-library.h
@@ -122,7 +122,7 @@ public:
/// Function to replace the the path with entryString
static Result replace(const char* pathIn, const String& entryString, SharedLibrary::Handle& handleOut);
- /// Function to change the path using the entryStrinct
+ /// Function to change the path using the entryString
static Result changePath(const char* pathIn, const String& entryString, SharedLibrary::Handle& handleOut);
void addEntry(const String& libName, Func func, const String& entryString) { m_entryMap.Add(libName, Entry{ func, entryString} ); }
diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp
index 5918f1551..be88e9d8c 100644
--- a/source/slang/slang-options.cpp
+++ b/source/slang/slang-options.cpp
@@ -65,8 +65,6 @@ struct OptionsParser
Slang::EndToEndCompileRequest* requestImpl = nullptr;
- Slang::RefPtr<Slang::ConfigurableSharedLibraryLoader> sharedLibraryLoader;
-
// A "translation unit" represents one or more source files
// that are processed as a single entity when it comes to
// semantic checking.
@@ -182,15 +180,6 @@ struct OptionsParser
RawTarget defaultTarget;
- void addSharedLibraryPath(SharedLibraryType libType, const String& path)
- {
- if (!sharedLibraryLoader)
- {
- sharedLibraryLoader = new ConfigurableSharedLibraryLoader;
- }
- sharedLibraryLoader->addEntry(libType, ConfigurableSharedLibraryLoader::changePath, path);
- }
-
int addTranslationUnit(
SlangSourceLanguage language,
Stage impliedStage)
@@ -615,25 +604,6 @@ struct OptionsParser
spSetPassThrough(compileRequest, passThrough);
}
- else if (argStr == "-dxc-path")
- {
- String name;
- SLANG_RETURN_ON_FAIL(tryReadCommandLineArgument(sink, arg, &argCursor, argEnd, name));
- addSharedLibraryPath(SharedLibraryType::Dxc, name);
- addSharedLibraryPath(SharedLibraryType::Dxil, name);
- }
- else if (argStr == "-glslang-path")
- {
- String name;
- SLANG_RETURN_ON_FAIL(tryReadCommandLineArgument(sink, arg, &argCursor, argEnd, name));
- addSharedLibraryPath(SharedLibraryType::Glslang, name);
- }
- else if (argStr == "-fxc-path")
- {
- String name;
- SLANG_RETURN_ON_FAIL(tryReadCommandLineArgument(sink, arg, &argCursor, argEnd, name));
- addSharedLibraryPath(SharedLibraryType::Fxc, name);
- }
else if (argStr.getLength() >= 2 && argStr[1] == 'D')
{
// The value to be defined might be part of the same option, as in:
@@ -836,6 +806,24 @@ struct OptionsParser
}
else
{
+ if (argStr.endsWith("-path"))
+ {
+ Index index = argStr.lastIndexOf('-');
+ if (index >= 0)
+ {
+ String name;
+ SLANG_RETURN_ON_FAIL(tryReadCommandLineArgument(sink, arg, &argCursor, argEnd, name));
+
+ String slice = argStr.subString(1, index - 1);
+ SlangPassThrough passThrough = SLANG_PASS_THROUGH_NONE;
+ if (SLANG_SUCCEEDED(_parsePassThrough(slice.getUnownedSlice(), passThrough)))
+ {
+ session->setPassThroughPath(passThrough, name.getBuffer());
+ continue;
+ }
+ }
+ }
+
sink->diagnose(SourceLoc(), Diagnostics::unknownCommandLineOption, argStr);
// TODO: print a usage message
return SLANG_FAIL;
@@ -1352,11 +1340,6 @@ struct OptionsParser
}
}
- if (sharedLibraryLoader)
- {
- spSessionSetSharedLibraryLoader(session, sharedLibraryLoader);
- }
-
return (sink->GetErrorCount() == 0) ? SLANG_OK : SLANG_FAIL;
}
};