summaryrefslogtreecommitdiff
path: root/slang.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-11-05 13:01:58 -0500
committerGitHub <noreply@github.com>2019-11-05 13:01:58 -0500
commitd326d941b383e0da673973e918ff0662132b0836 (patch)
tree1059d8468760612e05640047c66a13cd213cfaa1 /slang.h
parent608b7fba5411f9de2193ac604d38363463807410 (diff)
API support for IR modules - setting references to libs, and returns lib from compilation (#1105)
* Added RiffReadHelper * Move type to fourCC in Chunk simplifies some code. * Make MemoryArena able to track external blocks. Allow ownership of Data to vary. Changed IR serialization to use moved allocations to avoid copies. As it turns out all of the array writes could use unowned data, but doing so requires the IRData to stay in scope longer than IRSerialData, which it does at the moment - but perhaps needs better naming or a control for the feature. * Write out slang-module container. * WIP on -r option. Loading modules - with -r. * Making the serialized-module run (without using imported module). * Split compiling module from the test. * Separate module compilation with a function working. * Remove serialization test as not used. * Fix warning on gcc. * Updated test to have types across module boundary. * Allow entry point declaration. A test that tries to build with just an entry point declaration and a module. * Try to make link work with multiple modules. * Multi module linking first pass working. * Multi module test working with -module-name option * Added feature to repro manifest of approximation of command line that was used. * Use isDefinition - for determining to add decorations to entry point lowering. * Added support for repo-file-system.h More precise control of CacheFileSystem. Allow RelativeFileSystem to strip paths optionally. Use canonical paths in PathInfo cache. Fix bug in -D options for command line output of StateSerailizeUtil * Add missing slang-options.h * Fix bug in bit slang-state-serialize.cpp with bit removal. * Added documentation around -repro-file-system Added spLoadReproAsFileSystem function. * Fix warning. * spAddLibraryReference * * Add support for slang-lib extension * Container output when using -no-codegen option * Use the m_containerFormat to determine if the module container is constructed. Store the result in a blob. This allows for potential access via the API. Write the blob if a filename is set. Use m_ prefix for container variables. * Added spGetContainerCode. Made spGetCompileRequestCode work.
Diffstat (limited to 'slang.h')
-rw-r--r--slang.h29
1 files changed, 26 insertions, 3 deletions
diff --git a/slang.h b/slang.h
index 83811ffd1..7b2de6bd9 100644
--- a/slang.h
+++ b/slang.h
@@ -1393,6 +1393,18 @@ extern "C"
char const* source);
+ /** Add a slang library - such that its contents can be referenced during linking.
+ This is equivalent to the -r command line option.
+
+ @param request The compile request
+ @param libData The library data
+ @param libDataSize The size of the library data
+ */
+ SLANG_API SlangResult spAddLibraryReference(
+ SlangCompileRequest* request,
+ const void* libData,
+ size_t libDataSize);
+
/** Add a source string to the given translation unit.
@param request The compile request that owns the translation unit.
@@ -1614,16 +1626,27 @@ extern "C"
/** Get the output bytecode associated with an entire compile request.
- The lifetime of the output pointer is the same as `request`.
+ The lifetime of the output pointer is the same as `request` and the last spCompile.
- DEPRECIATED: No longer outputs anything.
+ @param request The request
+ @param outSize The size of the containers contents in bytes. Will be zero if there is no code available.
+ @returns Pointer to start of the contained data, or nullptr if there is no code available.
*/
SLANG_API void const* spGetCompileRequestCode(
SlangCompileRequest* request,
size_t* outSize);
+ /** Return the container code as a blob. The container blob is created as part of a compilation (with spCompile),
+ and a container is produced with a suitable ContainerFormat.
+
+ @param request The request
+ @param outSize The blob containing the container data.
+ @returns A `SlangResult` to indicate success or failure.
+ */
+ SLANG_API SlangResult spGetContainerCode(
+ SlangCompileRequest* request,
+ ISlangBlob** outBlob);
-
/** Load repro from memory specified.
Should only be performed on a newly created request.