summaryrefslogtreecommitdiff
path: root/source/slang/slang-options.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-options.cpp')
-rw-r--r--source/slang/slang-options.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp
index 5d3f7e015..545f222de 100644
--- a/source/slang/slang-options.cpp
+++ b/source/slang/slang-options.cpp
@@ -102,6 +102,7 @@ enum class OptionKind
EmitSpirvViaGLSL,
EmitSpirvDirectly,
+ SPIRVCoreGrammarJSON,
// Downstream
@@ -518,6 +519,8 @@ void initCommandOptions(CommandOptions& options)
"Generate SPIR-V output by compiling generated GLSL with glslang (default)" },
{ OptionKind::EmitSpirvDirectly, "-emit-spirv-directly", nullptr,
"Generate SPIR-V output direclty rather than by compiling generated GLSL with glslang" },
+ { OptionKind::SPIRVCoreGrammarJSON, "-spirv-core-grammar", nullptr,
+ "A path to a specific spirv.core.grammar.json to use when generating SPIR-V output" },
#endif
};
@@ -889,6 +892,8 @@ struct OptionsParser
slang::CompileStdLibFlags m_compileStdLibFlags = 0;
bool m_hasLoadedRepro = false;
+ String m_spirvCoreGrammarJSONPath;
+
CommandLineReader m_reader;
CommandOptionsWriter::Style m_helpStyle = CommandOptionsWriter::Style::Text;
@@ -2300,6 +2305,13 @@ SlangResult OptionsParser::_parse(
getCurrentTarget()->targetFlags |= SLANG_TARGET_FLAG_GENERATE_SPIRV_DIRECTLY;
}
break;
+ case OptionKind::SPIRVCoreGrammarJSON:
+ {
+ CommandLineArg path;
+ SLANG_RETURN_ON_FAIL(m_reader.expectArg(path));
+ m_spirvCoreGrammarJSONPath = path.value;
+ }
+ break;
case OptionKind::DefaultDownstreamCompiler:
{
@@ -2843,6 +2855,11 @@ SlangResult OptionsParser::_parse(
m_compileRequest->setMatrixLayoutMode(m_defaultMatrixLayoutMode);
}
+ if(m_spirvCoreGrammarJSONPath.getLength())
+ {
+ m_session->setSPIRVCoreGrammar(m_spirvCoreGrammarJSONPath.getBuffer());
+ }
+
// Next we need to sort out the output files specified with `-o`, and
// figure out which entry point and/or target they apply to.
//