diff options
| author | cheneym2 <acheney@nvidia.com> | 2024-09-05 14:59:28 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-05 11:59:28 -0700 |
| commit | 313677160a186efebf83fab4df7d08dd119a5cd2 (patch) | |
| tree | e12e159846f0b7b0e3567d028ad4a57cd9f001aa /source/slang/slang-options.cpp | |
| parent | 33e8bfd43f66613f6f834fb0e1816ef43071f2e4 (diff) | |
Initial -embed-spirv support (#4974)
* Initial -embed-spirv support
Add support for SPIR-V precompilation using the framework
established for DXIL.
Work on #4883
* SLANG_UNUSED
* Add linkage attributes to exported spirv functions
* Combine DXIL and SPIRV paths
* Whitespace fix
* Merge remaining precompiled spirv/dxil paths
* Change inst accessors to return codegentarget
* Add unit test for precompiled spirv
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-options.cpp')
| -rw-r--r-- | source/slang/slang-options.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp index f12a66790..c02a00957 100644 --- a/source/slang/slang-options.cpp +++ b/source/slang/slang-options.cpp @@ -354,8 +354,6 @@ void initCommandOptions(CommandOptions& options) { OptionKind::DisableShortCircuit, "-disable-short-circuit", nullptr, "Disable short-circuiting for \"&&\" and \"||\" operations" }, { OptionKind::UnscopedEnum, "-unscoped-enum", nullptr, "Treat enums types as unscoped by default."}, { OptionKind::PreserveParameters, "-preserve-params", nullptr, "Preserve all resource parameters in the output code, even if they are not used by the shader."}, - { OptionKind::EmbedDXIL, "-embed-dxil", nullptr, - "Embed DXIL into emitted slang-modules for faster linking" }, }; _addOptions(makeConstArrayView(generalOpts), options); @@ -431,6 +429,7 @@ void initCommandOptions(CommandOptions& options) "A path to a specific spirv.core.grammar.json to use when generating SPIR-V output" }, { OptionKind::IncompleteLibrary, "-incomplete-library", nullptr, "Allow generating code from incomplete libraries with unresolved external functions" }, + { OptionKind::EmbedDownstreamIR, "-embed-downstream-ir", nullptr, "Embed downstream IR into emitted slang IR" }, }; _addOptions(makeConstArrayView(targetOpts), options); @@ -1931,7 +1930,11 @@ SlangResult OptionsParser::_parse( linkage->m_optionSet.set(optionKind, compressionType); break; } - case OptionKind::EmbedDXIL: m_compileRequest->setEmbedDXIL(true); break; + case OptionKind::EmbedDownstreamIR: + { + getCurrentTarget()->optionSet.add(CompilerOptionName::EmbedDownstreamIR, true); + break; + } case OptionKind::Target: { CommandLineArg name; @@ -2778,6 +2781,12 @@ SlangResult OptionsParser::_parse( { m_compileRequest->setTargetGenerateWholeProgram(targetID, true); } + + if (rawTarget.optionSet.getBoolOption(CompilerOptionName::EmbedDownstreamIR)) + { + m_compileRequest->setTargetEmbedDownstreamIR(targetID, true); + } + } // Next we need to sort out the output files specified with `-o`, and |
