summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaizhangNV <149626564+kaizhangNV@users.noreply.github.com>2024-11-07 00:59:59 -0600
committerGitHub <noreply@github.com>2024-11-06 22:59:59 -0800
commitd53a3ab92d94b133a6c1992e91e7a08fe99b3337 (patch)
treeacac7fee2ea8c2206c2abab9b3b86d27296efb52
parent7c195d3b31c85d8b53ad5848b7730bb2be6c6a89 (diff)
Fix the logic bug in spirv-emit compile option (#5512)
-rw-r--r--source/slang/slang-compiler-options.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/source/slang/slang-compiler-options.cpp b/source/slang/slang-compiler-options.cpp
index 84a22535a..9b7091756 100644
--- a/source/slang/slang-compiler-options.cpp
+++ b/source/slang/slang-compiler-options.cpp
@@ -21,15 +21,16 @@ void CompilerOptionSet::load(uint32_t count, slang::CompilerOptionEntry* entries
// When we see option EmitSpirvDirectly or EmitSpirvViaGLSL, we will need to
// translate them to EmitSpirvMethod.
- if (entries[i].name == slang::CompilerOptionName::EmitSpirvDirectly && value.intValue)
+ if (entries[i].name == slang::CompilerOptionName::EmitSpirvDirectly)
{
- set(slang::CompilerOptionName::EmitSpirvMethod, SLANG_EMIT_SPIRV_DIRECTLY);
+ set(slang::CompilerOptionName::EmitSpirvMethod,
+ value.intValue != 0 ? SLANG_EMIT_SPIRV_DIRECTLY : SLANG_EMIT_SPIRV_VIA_GLSL);
}
- else if (entries[i].name == slang::CompilerOptionName::EmitSpirvViaGLSL && value.intValue)
+ else if (entries[i].name == slang::CompilerOptionName::EmitSpirvViaGLSL)
{
SlangEmitSpirvMethod current =
getEnumOption<SlangEmitSpirvMethod>(slang::CompilerOptionName::EmitSpirvMethod);
- if (current != SLANG_EMIT_SPIRV_DEFAULT)
+ if (current == SLANG_EMIT_SPIRV_DEFAULT && value.intValue)
{
set(CompilerOptionName::EmitSpirvMethod, SLANG_EMIT_SPIRV_VIA_GLSL);
}