summaryrefslogtreecommitdiffstats
path: root/tools/render-test/render-test-main.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-11-18 18:12:43 -0500
committerGitHub <noreply@github.com>2020-11-18 18:12:43 -0500
commite140c4950eb8c69606386ca57284c0655513b9e1 (patch)
tree1361dcf8cfc1597b63960226006af301ac82bfc6 /tools/render-test/render-test-main.cpp
parentd898d561e3c76ecf38db434ec7fbb4bbd0e25cb2 (diff)
Test for serializing out and reading back Stdlib (#1605)
* #include an absolute path didn't work - because paths were taken to always be relative. * Mangling/module name extraction for GenericDecl * Add comment on SerialFilter to explain re-enabling Stmt. * Support setting up SyntaxDecl when reconstructed after deserialization. * Improvements to setup SyntaxDecl. * Fix typo so can read compressed SourceLocs. * Fix issue with SourceManger. * Simple test for serializing out stdlib and reading back in. * Fix calling convention. * Add override to StdLib impls. * Fix typo. * Apply testing to an actual compute test when using load-stdlib Make -load/compile-stdlib processable by Slang Move out testing into util into TestToolUtil so can be shared. * Slightly more concise setup of session. * Fix some errors introduced with session handling. * Made setup for compile same across slangc and slangc-tool.
Diffstat (limited to 'tools/render-test/render-test-main.cpp')
-rw-r--r--tools/render-test/render-test-main.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/render-test/render-test-main.cpp b/tools/render-test/render-test-main.cpp
index 85e038e5a..f6f3e4ce6 100644
--- a/tools/render-test/render-test-main.cpp
+++ b/tools/render-test/render-test-main.cpp
@@ -787,14 +787,25 @@ static SlangResult _innerMain(Slang::StdWriters* stdWriters, SlangSession* sessi
}
}
-SLANG_TEST_TOOL_API SlangResult innerMain(Slang::StdWriters* stdWriters, SlangSession* session, int argcIn, const char*const* argvIn)
+SLANG_TEST_TOOL_API SlangResult innerMain(Slang::StdWriters* stdWriters, SlangSession* sharedSession, int inArgc, const char*const* inArgv)
{
using namespace Slang;
+ // Assume we will used the shared session
+ ComPtr<slang::IGlobalSession> session(sharedSession);
+
+ // The sharedSession always has a pre-loaded stdlib.
+ // This differed test checks if the command line has an option to setup the stdlib.
+ // If so we *don't* use the sharedSession, and create a new stdlib-less session just for this compilation.
+ if (TestToolUtil::hasDeferredStdLib(Index(inArgc - 1), inArgv + 1))
+ {
+ SLANG_RETURN_ON_FAIL(slang_createGlobalSessionWithoutStdLib(SLANG_API_VERSION, session.writeRef()));
+ }
+
SlangResult res = SLANG_FAIL;
try
{
- res = _innerMain(stdWriters, session, argcIn, argvIn);
+ res = _innerMain(stdWriters, session, inArgc, inArgv);
}
catch (const Slang::Exception& exception)
{