diff options
Diffstat (limited to 'source')
| -rwxr-xr-x | source/slang/slang-compiler.h | 23 | ||||
| -rw-r--r-- | source/slang/slang.cpp | 32 |
2 files changed, 54 insertions, 1 deletions
diff --git a/source/slang/slang-compiler.h b/source/slang/slang-compiler.h index 0eb6f992d..01bdd8502 100755 --- a/source/slang/slang-compiler.h +++ b/source/slang/slang-compiler.h @@ -294,6 +294,11 @@ namespace Slang SLANG_NO_THROW SlangResult SLANG_MCALL link( slang::IComponentType** outLinkedComponentType, ISlangBlob** outDiagnostics) SLANG_OVERRIDE; + SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointHostCallable( + int entryPointIndex, + int targetIndex, + ISlangSharedLibrary** outSharedLibrary, + slang::IBlob** outDiagnostics) SLANG_OVERRIDE; /// Get the linkage (aka "session" in the public API) for this component type. Linkage* getLinkage() { return m_linkage; } @@ -705,6 +710,15 @@ namespace Slang outDiagnostics); } + SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointHostCallable( + int entryPointIndex, + int targetIndex, + ISlangSharedLibrary** outSharedLibrary, + slang::IBlob** outDiagnostics) SLANG_OVERRIDE + { + return Super::getEntryPointHostCallable(entryPointIndex, targetIndex, outSharedLibrary, outDiagnostics); + } + /// Create an entry point that refers to the given function. static RefPtr<EntryPoint> create( Linkage* linkage, @@ -912,6 +926,15 @@ namespace Slang outDiagnostics); } + SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointHostCallable( + int entryPointIndex, + int targetIndex, + ISlangSharedLibrary** outSharedLibrary, + slang::IBlob** outDiagnostics) SLANG_OVERRIDE + { + return Super::getEntryPointHostCallable(entryPointIndex, targetIndex, outSharedLibrary, outDiagnostics); + } + SLANG_NO_THROW SlangResult SLANG_MCALL findEntryPointByName( char const* name, slang::IEntryPoint** outEntryPoint) SLANG_OVERRIDE diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index 2ad5d25f8..ae3a1f419 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -2733,6 +2733,33 @@ SLANG_NO_THROW SlangResult SLANG_MCALL ComponentType::getEntryPointCode( return SLANG_OK; } +SLANG_NO_THROW SlangResult SLANG_MCALL ComponentType::getEntryPointHostCallable( + int entryPointIndex, + int targetIndex, + ISlangSharedLibrary** outSharedLibrary, + 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); + auto& entryPointResult = targetProgram->getOrCreateEntryPointResult(entryPointIndex, &sink); + sink.getBlobIfNeeded(outDiagnostics); + + if(entryPointResult.format == ResultFormat::None ) + return SLANG_FAIL; + + ComPtr<ISlangSharedLibrary> sharedLibrary; + SLANG_RETURN_ON_FAIL(entryPointResult.getSharedLibrary(sharedLibrary)); + + *outSharedLibrary = sharedLibrary.detach(); + return SLANG_OK; +} + RefPtr<ComponentType> ComponentType::specialize( SpecializationArg const* inSpecializationArgs, SlangInt specializationArgCount, @@ -4385,7 +4412,10 @@ SlangReflection* EndToEndCompileRequest::getReflection() auto targetReq = linkage->targets[targetIndex]; auto targetProgram = program->getTargetProgram(targetReq); - auto programLayout = targetProgram->getExistingLayout(); + + + DiagnosticSink sink(linkage->getSourceManager(), Lexer::sourceLocationLexer); + auto programLayout = targetProgram->getOrCreateLayout(&sink); return (SlangReflection*)programLayout; } |
