diff options
Diffstat (limited to 'source/slang/slang.cpp')
| -rw-r--r-- | source/slang/slang.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index 7b22d04de..9379f3b03 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -670,17 +670,17 @@ SlangPassThrough Session::getDownstreamCompilerForTransition(SlangCompileTarget return (SlangPassThrough)m_codeGenTransitionMap.getTransition(source, target); } + const auto desc = ArtifactDesc::makeFromCompileTarget(inTarget); + // Special case host-callable - if (target == CodeGenTarget::ShaderHostCallable) + if ((desc.kind == ArtifactKind::Callable) && + (source == CodeGenTarget::CSource || source == CodeGenTarget::CPPSource)) { - if (source == CodeGenTarget::CSource || source == CodeGenTarget::CPPSource) + // We prefer LLVM if it's available + DownstreamCompiler* llvm = getOrLoadDownstreamCompiler(PassThroughMode::LLVM, nullptr); + if (llvm) { - // We prefer LLVM if it's available - DownstreamCompiler* llvm = getOrLoadDownstreamCompiler(PassThroughMode::LLVM, nullptr); - if (llvm) - { - return SLANG_PASS_THROUGH_LLVM; - } + return SLANG_PASS_THROUGH_LLVM; } } @@ -1334,6 +1334,7 @@ CapabilitySet TargetRequest::getTargetCaps() case CodeGenTarget::CPPSource: case CodeGenTarget::HostExecutable: case CodeGenTarget::ShaderSharedLibrary: + case CodeGenTarget::HostHostCallable: case CodeGenTarget::ShaderHostCallable: atoms.add(CapabilityAtom::CPP); break; @@ -4711,6 +4712,11 @@ static SlangResult _getWholeProgramResult( auto linkage = req->getLinkage(); auto program = req->getSpecializedGlobalAndEntryPointsComponentType(); + if (!program) + { + return SLANG_FAIL; + } + Index targetCount = linkage->targets.getCount(); if ((targetIndex < 0) || (targetIndex >= targetCount)) { |
