From d53a3ab92d94b133a6c1992e91e7a08fe99b3337 Mon Sep 17 00:00:00 2001 From: kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> Date: Thu, 7 Nov 2024 00:59:59 -0600 Subject: Fix the logic bug in spirv-emit compile option (#5512) --- source/slang/slang-compiler-options.cpp | 9 +++++---- 1 file 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(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); } -- cgit v1.2.3