summaryrefslogtreecommitdiffstats
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.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp
index 969ce4143..bc83afe65 100644
--- a/source/slang/slang-options.cpp
+++ b/source/slang/slang-options.cpp
@@ -2728,7 +2728,20 @@ SlangResult OptionsParser::_parse(int argc, char const* const* argv)
case OptionKind::EmitSpirvViaGLSL:
case OptionKind::EmitSpirvDirectly:
{
- getCurrentTarget()->optionSet.add(optionKind, true);
+ SlangEmitSpirvMethod selectMethod = (optionKind == OptionKind::EmitSpirvViaGLSL)
+ ? SLANG_EMIT_SPIRV_VIA_GLSL
+ : SLANG_EMIT_SPIRV_DIRECTLY;
+
+ SlangEmitSpirvMethod currentMethod =
+ getCurrentTarget()->optionSet.getEnumOption<SlangEmitSpirvMethod>(
+ OptionKind::EmitSpirvMethod);
+ // When both flag turns on, spirv-direcly mode will always take higher priority.
+ // By default (value 0), spirv-via-glsl mode is used, and any input flag can
+ // override the default value.
+ if (selectMethod > currentMethod)
+ {
+ getCurrentTarget()->optionSet.set(OptionKind::EmitSpirvMethod, selectMethod);
+ }
}
break;
case OptionKind::SPIRVCoreGrammarJSON: