summaryrefslogtreecommitdiffstats
path: root/source/slang/options.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2018-11-06 14:28:25 -0500
committerGitHub <noreply@github.com>2018-11-06 14:28:25 -0500
commit1185bd464092f372430cbfaa15a7be4dcaa90752 (patch)
treeb3b68f2d9de00c0845f4912a797f10b27741031f /source/slang/options.cpp
parent453331951b0df2a612f9bc0d68eab2ad786ec5bf (diff)
Feature/shared library refactor (#712)
* * Added ISlangSharedLibraryLoader and ISlangSharedLibrary * Implemented default implementations * Added slang API function to get/set the ISlangSharedLibraryLoader on the session * Put function caching onto the Session - so that if the loader is chaged, its easy to reset the shared libraries, and functions * Run premake. * Fix problem with setting null, would cause an unnecessary function/shared lib flush. * * Unload SharedLibrary when DefaultSharedLibrary is deleted. * Make SharedLibrary handle unload safely if already unloaded. * Refactor SharedLibrary, such that it becomes a utility class - simplifying it's semantics. * Simplified ISlangSharedLibrary such that doesn't have unload and isLoaded so easier to implement. Use updated SharedLibrary impl. * Disable aarch64 on windows * Premake windows files without aarch64 build. * Moved slang-shared-library to core (so can be used in code outside of main slang) Fixed problem in premake5 where on windows projects were incorrectly constructed * Allowed RefObject to base class of com types Added ConfigurableSharedLibraryLoader Added -dxc-path -fxc-path -glslang-path Fix problem with dxc-path not honoring it's path when loading dxil * Added documentation for command line control of dll loading paths. * Remove some tabbing issues. * Change name of include guard.
Diffstat (limited to 'source/slang/options.cpp')
-rw-r--r--source/slang/options.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/source/slang/options.cpp b/source/slang/options.cpp
index cfa631340..9f65d0e5c 100644
--- a/source/slang/options.cpp
+++ b/source/slang/options.cpp
@@ -43,6 +43,8 @@ struct OptionsParser
Slang::CompileRequest* 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.
@@ -158,6 +160,15 @@ 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)
@@ -566,6 +577,25 @@ struct OptionsParser
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[1] == 'D')
{
// The value to be defined might be part of the same option, as in:
@@ -1221,6 +1251,11 @@ struct OptionsParser
}
}
+ if (sharedLibraryLoader)
+ {
+ spSessionSetSharedLibraryLoader(session, sharedLibraryLoader);
+ }
+
return (sink->GetErrorCount() == 0) ? SLANG_OK : SLANG_FAIL;
}
};
@@ -1236,6 +1271,7 @@ SlangResult parseOptions(
OptionsParser parser;
parser.compileRequest = compileRequestIn;
parser.requestImpl = compileRequest;
+ parser.session = (SlangSession*)compileRequest->mSession;
Result res = parser.parse(argc, argv);