diff options
| author | jarcherNV <jarcher@nvidia.com> | 2025-06-12 19:14:49 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-12 19:14:49 -0700 |
| commit | 9c8fab83a53c43e345566c35f87c16fe7b815e01 (patch) | |
| tree | d7d487050656b927a48de9bd6473cf757c6dc94d /source/slang/slang.cpp | |
| parent | 60b66c309075e91824aef69a153e304561ca6041 (diff) | |
Fix API changes from separate debugging support (#7397)
Recent separate debugging support added two new functions which broke
backwards compatibility. This change restores the old API and moves the
new functions to an IComponentType2 interface which can be used if
separate debug files are needed.
Diffstat (limited to 'source/slang/slang.cpp')
| -rw-r--r-- | source/slang/slang.cpp | 84 |
1 files changed, 43 insertions, 41 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index daebddeae..6ee50251a 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -5322,6 +5322,8 @@ ISlangUnknown* ComponentType::getInterface(Guid const& guid) } if (guid == IModulePrecompileService_Experimental::getTypeGuid()) return static_cast<slang::IModulePrecompileService_Experimental*>(this); + if (guid == IComponentType2::getTypeGuid()) + return static_cast<slang::IComponentType2*>(this); return nullptr; } @@ -5568,33 +5570,6 @@ SLANG_NO_THROW SlangResult SLANG_MCALL ComponentType::getEntryPointMetadata( return SLANG_OK; } -SLANG_NO_THROW SlangResult SLANG_MCALL ComponentType::getEntryPointCompileResult( - SlangInt entryPointIndex, - Int targetIndex, - slang::ICompileResult** outCompileResult, - slang::IBlob** outDiagnostics) -{ - auto linkage = getLinkage(); - if (targetIndex < 0 || targetIndex >= linkage->targets.getCount()) - return SLANG_E_INVALID_ARG; - auto target = linkage->targets[targetIndex]; - - auto targetProgram = getTargetProgram(target); - - DiagnosticSink sink(linkage->getSourceManager(), Lexer::sourceLocationLexer); - applySettingsToDiagnosticSink(&sink, &sink, linkage->m_optionSet); - applySettingsToDiagnosticSink(&sink, &sink, m_optionSet); - - IArtifact* artifact = targetProgram->getOrCreateEntryPointResult(entryPointIndex, &sink); - sink.getBlobIfNeeded(outDiagnostics); - if (artifact == nullptr) - return SLANG_E_NOT_AVAILABLE; - - *outCompileResult = static_cast<slang::ICompileResult*>(artifact); - (*outCompileResult)->addRef(); - return SLANG_OK; -} - RefPtr<ComponentType> ComponentType::specialize( SpecializationArg const* inSpecializationArgs, SlangInt specializationArgCount, @@ -5737,6 +5712,47 @@ SLANG_NO_THROW SlangResult SLANG_MCALL ComponentType::linkWithOptions( return SLANG_OK; } +SLANG_NO_THROW SlangResult SLANG_MCALL ComponentType::getEntryPointCompileResult( + SlangInt entryPointIndex, + Int targetIndex, + slang::ICompileResult** outCompileResult, + slang::IBlob** outDiagnostics) +{ + auto linkage = getLinkage(); + if (targetIndex < 0 || targetIndex >= linkage->targets.getCount()) + return SLANG_E_INVALID_ARG; + auto target = linkage->targets[targetIndex]; + + auto targetProgram = getTargetProgram(target); + + DiagnosticSink sink(linkage->getSourceManager(), Lexer::sourceLocationLexer); + applySettingsToDiagnosticSink(&sink, &sink, linkage->m_optionSet); + applySettingsToDiagnosticSink(&sink, &sink, m_optionSet); + + IArtifact* artifact = targetProgram->getOrCreateEntryPointResult(entryPointIndex, &sink); + sink.getBlobIfNeeded(outDiagnostics); + if (artifact == nullptr) + return SLANG_E_NOT_AVAILABLE; + + *outCompileResult = static_cast<slang::ICompileResult*>(artifact); + (*outCompileResult)->addRef(); + return SLANG_OK; +} + +SLANG_NO_THROW SlangResult SLANG_MCALL ComponentType::getTargetCompileResult( + Int targetIndex, + slang::ICompileResult** outCompileResult, + slang::IBlob** outDiagnostics) +{ + IArtifact* artifact = getTargetArtifact(targetIndex, outDiagnostics); + if (artifact == nullptr) + return SLANG_E_NOT_AVAILABLE; + + *outCompileResult = static_cast<slang::ICompileResult*>(artifact); + (*outCompileResult)->addRef(); + return SLANG_OK; +} + /// Visitor used by `ComponentType::enumerateModules` struct EnumerateModulesVisitor : ComponentTypeVisitor { @@ -5930,20 +5946,6 @@ SLANG_NO_THROW SlangResult SLANG_MCALL ComponentType::getTargetMetadata( return SLANG_OK; } -SLANG_NO_THROW SlangResult SLANG_MCALL ComponentType::getTargetCompileResult( - Int targetIndex, - slang::ICompileResult** outCompileResult, - slang::IBlob** outDiagnostics) -{ - IArtifact* artifact = getTargetArtifact(targetIndex, outDiagnostics); - if (artifact == nullptr) - return SLANG_E_NOT_AVAILABLE; - - *outCompileResult = static_cast<slang::ICompileResult*>(artifact); - //(*outCompileResult)->addRef(); // TODO: Needed if using a ComPtr. - return SLANG_OK; -} - // // CompositeComponentType // |
