From fcc570c9dc27889a5fe10c9df783f9760e126d17 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 20 Nov 2023 11:00:39 -0800 Subject: Allow whole program compile when using direct spirv backend. (#3342) Co-authored-by: Yong He --- source/slang/slang-options.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp index 1c1ad8f1c..9830fb18c 100644 --- a/source/slang/slang-options.cpp +++ b/source/slang/slang-options.cpp @@ -2945,6 +2945,8 @@ SlangResult OptionsParser::_parse( (m_rawTargets[0].format == CodeGenTarget::HostCPPSource || m_rawTargets[0].format == CodeGenTarget::PyTorchCppBinding || m_rawTargets[0].format == CodeGenTarget::CUDASource || + m_rawTargets[0].format == CodeGenTarget::SPIRV || + m_rawTargets[0].format == CodeGenTarget::SPIRVAssembly || ArtifactDescUtil::makeDescForCompileTarget(asExternal(m_rawTargets[0].format)).kind == ArtifactKind::HostCallable)) { RawOutput rawOutput; @@ -3011,9 +3013,15 @@ SlangResult OptionsParser::_parse( case CodeGenTarget::ShaderSharedLibrary: case CodeGenTarget::PyTorchCppBinding: case CodeGenTarget::DXIL: - rawOutput.isWholeProgram = true; break; + case CodeGenTarget::SPIRV: + case CodeGenTarget::SPIRVAssembly: + if (getCurrentTarget()->targetFlags & SLANG_TARGET_FLAG_GENERATE_SPIRV_DIRECTLY) + { + rawOutput.isWholeProgram = true; + } + break; default: m_sink->diagnose(SourceLoc(), Diagnostics::cannotMatchOutputFileToEntryPoint, rawOutput.path); break; -- cgit v1.2.3