diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-12-05 14:54:21 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-05 14:54:21 -0500 |
| commit | 4e2cfc95fb02fb47f02b8702494929e7cca3bec7 (patch) | |
| tree | 305a5efb0decc8248bf04832c4a3f527311be607 /source/slang/slang-options.cpp | |
| parent | 138a0c90d7a2d04c58569e1a8f6afa114d3e77e1 (diff) | |
Added -dump-intermediate-prefix option (#1146)
* * Added ability to name the prefix for intermediates
* Allowed paramters after -load-repro - as pretty useful if somewhat risky thing to do (depending on parameters)
* Fix issue around setting arbitrary state outside of load-repro.
Diffstat (limited to 'source/slang/slang-options.cpp')
| -rw-r--r-- | source/slang/slang-options.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp index 1523170cf..c7ede8d93 100644 --- a/source/slang/slang-options.cpp +++ b/source/slang/slang-options.cpp @@ -512,6 +512,8 @@ struct OptionsParser SlangMatrixLayoutMode defaultMatrixLayoutMode = SLANG_MATRIX_LAYOUT_MODE_UNKNOWN; + bool hasLoadedRepro = false; + char const* const* argCursor = &argv[0]; char const* const* argEnd = &argv[argc]; while (argCursor != argEnd) @@ -533,6 +535,12 @@ struct OptionsParser { spSetDumpIntermediates(compileRequest, true); } + else if (argStr == "-dump-intermediate-prefix") + { + String prefix; + SLANG_RETURN_ON_FAIL(tryReadCommandLineArgument(sink, arg, &argCursor, argEnd, prefix)); + requestImpl->getBackEndReq()->m_dumpIntermediatePrefix = prefix; + } else if(argStr == "-dump-ir" ) { requestImpl->getFrontEndReq()->shouldDumpIR = true; @@ -587,13 +595,7 @@ struct OptionsParser SLANG_RETURN_ON_FAIL(StateSerializeUtil::load(base, requestState, fileSystem, requestImpl)); - if (argCursor < argEnd) - { - sink->diagnose(SourceLoc(), Diagnostics::parametersAfterLoadReproIgnored); - return SLANG_FAIL; - } - - return SLANG_OK; + hasLoadedRepro = true; } else if (argStr == "-repro-file-system") { @@ -1055,6 +1057,15 @@ struct OptionsParser } } + // TODO(JS): This is a restriction because of how setting of state works for load repro + // If a repro has been loaded, then many of the following options will overwrite + // what was set up. So for now they are ignored, and only parameters set as part + // of the loop work if they are after -load-repro + if (hasLoadedRepro) + { + return SLANG_OK; + } + spSetCompileFlags(compileRequest, flags); // As a compatability feature, if the user didn't list any explicit entry |
