summaryrefslogtreecommitdiff
path: root/source/slang/compiler.h
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/compiler.h
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/compiler.h')
-rw-r--r--source/slang/compiler.h29
1 files changed, 26 insertions, 3 deletions
diff --git a/source/slang/compiler.h b/source/slang/compiler.h
index 1f4a4736a..c8c242568 100644
--- a/source/slang/compiler.h
+++ b/source/slang/compiler.h
@@ -1,7 +1,9 @@
-#ifndef RASTER_SHADER_COMPILER_H
-#define RASTER_SHADER_COMPILER_H
+#ifndef SLANG_COMPILER_H_INCLUDED
+#define SLANG_COMPILER_H_INCLUDED
#include "../core/basic.h"
+#include "../core/slang-shared-library.h"
+
#include "../../slang-com-ptr.h"
#include "diagnostics.h"
@@ -77,7 +79,7 @@ namespace Slang
// When storing the layout for a matrix-type
// value, we need to know whether it has been
- // laid ot with row-major or column-major
+ // laid out with row-major or column-major
// storage.
//
enum MatrixLayoutMode
@@ -503,6 +505,15 @@ namespace Slang
class Session
{
public:
+ enum class SharedLibraryFuncType
+ {
+ Glslang_Compile,
+ Fxc_D3DCompile,
+ Fxc_D3DDisassemble,
+ Dxc_DxcCreateInstance,
+ CountOf,
+ };
+
//
RefPtr<Scope> baseLanguageScope;
@@ -544,6 +555,10 @@ namespace Slang
RefPtr<Type> constExprRate;
RefPtr<Type> irBasicBlockType;
+ ComPtr<ISlangSharedLibraryLoader> sharedLibraryLoader; ///< The shared library loader (never null)
+ ComPtr<ISlangSharedLibrary> sharedLibraries[int(SharedLibraryType::CountOf)]; ///< The loaded shared libraries
+ SlangFuncPtr sharedLibraryFunctions[int(SharedLibraryFuncType::CountOf)];
+
Dictionary<int, RefPtr<Type>> builtinTypes;
Dictionary<String, Decl*> magicDecls;
@@ -602,6 +617,14 @@ namespace Slang
void destroyTypeCheckingCache();
//
+ /// Will try to load the library by specified name (using the set loader), if not one already available.
+ ISlangSharedLibrary* getOrLoadSharedLibrary(SharedLibraryType type, DiagnosticSink* sink);
+
+ /// Gets a shared library by type, or null if not loaded
+ ISlangSharedLibrary* getSharedLibrary(SharedLibraryType type) const { return sharedLibraries[int(type)]; }
+
+ SlangFuncPtr getSharedLibraryFunc(SharedLibraryFuncType type, DiagnosticSink* sink);
+
Session();
void addBuiltinSource(