summaryrefslogtreecommitdiffstats
path: root/source/slang/slang.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang.cpp')
-rw-r--r--source/slang/slang.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 21944e4f3..ee0aa4c14 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -842,6 +842,16 @@ Session::createSession(slang::SessionDesc const& inDesc, slang::ISession** outSe
}
}
+ // If any target requires debug info, then we will need to enable debug info when lowering to
+ // target-agnostic IR. The target-agnostic IR will only include debug info if the linkage IR
+ // options specify that it should, so make sure the linkage debug info level is greater than or
+ // equal to that of any target.
+ DebugInfoLevel linkageDebugInfoLevel = linkage->m_optionSet.getDebugInfoLevel();
+ for (auto target : linkage->targets)
+ linkageDebugInfoLevel =
+ Math::Max(linkageDebugInfoLevel, target->getOptionSet().getDebugInfoLevel());
+ linkage->m_optionSet.set(CompilerOptionName::DebugInformation, linkageDebugInfoLevel);
+
*outSession = asExternal(linkage.detach());
return SLANG_OK;
}
@@ -1337,7 +1347,10 @@ void Linkage::addTarget(slang::TargetDesc const& desc)
optionSet.setProfile(Profile(desc.profile));
optionSet.set(CompilerOptionName::LineDirectiveMode, LineDirectiveMode(desc.lineDirectiveMode));
optionSet.set(CompilerOptionName::GLSLForceScalarLayout, desc.forceGLSLScalarBufferLayout);
- optionSet.load(desc.compilerOptionEntryCount, desc.compilerOptionEntries);
+
+ CompilerOptionSet targetOptions;
+ targetOptions.load(desc.compilerOptionEntryCount, desc.compilerOptionEntries);
+ optionSet.overrideWith(targetOptions);
}
#if 0