Skip to content

Commit d53a3ab

Browse files
authored
Fix the logic bug in spirv-emit compile option (shader-slang#5512)
1 parent 7c195d3 commit d53a3ab

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

source/slang/slang-compiler-options.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@ void CompilerOptionSet::load(uint32_t count, slang::CompilerOptionEntry* entries
2121

2222
// When we see option EmitSpirvDirectly or EmitSpirvViaGLSL, we will need to
2323
// translate them to EmitSpirvMethod.
24-
if (entries[i].name == slang::CompilerOptionName::EmitSpirvDirectly && value.intValue)
24+
if (entries[i].name == slang::CompilerOptionName::EmitSpirvDirectly)
2525
{
26-
set(slang::CompilerOptionName::EmitSpirvMethod, SLANG_EMIT_SPIRV_DIRECTLY);
26+
set(slang::CompilerOptionName::EmitSpirvMethod,
27+
value.intValue != 0 ? SLANG_EMIT_SPIRV_DIRECTLY : SLANG_EMIT_SPIRV_VIA_GLSL);
2728
}
28-
else if (entries[i].name == slang::CompilerOptionName::EmitSpirvViaGLSL && value.intValue)
29+
else if (entries[i].name == slang::CompilerOptionName::EmitSpirvViaGLSL)
2930
{
3031
SlangEmitSpirvMethod current =
3132
getEnumOption<SlangEmitSpirvMethod>(slang::CompilerOptionName::EmitSpirvMethod);
32-
if (current != SLANG_EMIT_SPIRV_DEFAULT)
33+
if (current == SLANG_EMIT_SPIRV_DEFAULT && value.intValue)
3334
{
3435
set(CompilerOptionName::EmitSpirvMethod, SLANG_EMIT_SPIRV_VIA_GLSL);
3536
}

0 commit comments

Comments
 (0)