diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2022-04-21 13:47:18 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-21 13:47:18 -0400 |
| commit | 3638e7735be67c8f4dae3f4544134441aa1e029d (patch) | |
| tree | f59c6965321ddcc5991df2bab3ea507b3ce50292 /source/slang/slang-compiler.cpp | |
| parent | 34f8b5e722aede018e275324c43055cad9a9ca5a (diff) | |
`export` support in HLSL (#2188)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Compile to a dxil library.
* Added CompileProduct.
* Support handling of ModuleLibrary.
* CacheBehavior -> Cache
* Use CompileProduct for -r references.
* CompileProduct -> Artifact.
* Determining an artifact type on binding.
* Determine binary linkability.
* Added Artifact::exists.
* Added ArtifactKeep.
* Small fixes.
* Small improvements to Artifact.
* Add zip extension.
* Fix some comments.
* Fix multiple adding of PublicDecoration.
Make public output export for DXIL/lib.
Add checking for simpleDecorations such that only added once.
* Use 'whole program' to identify library build.
* Add -target dxil so test infrastructure knows it needs DXC.
Diffstat (limited to 'source/slang/slang-compiler.cpp')
| -rw-r--r-- | source/slang/slang-compiler.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp index 80899e69e..881194bcb 100644 --- a/source/slang/slang-compiler.cpp +++ b/source/slang/slang-compiler.cpp @@ -1203,11 +1203,26 @@ void printDiagnosticArg(StringBuilder& sb, CodeGenTarget val) auto targetReq = getTargetReq(); const auto entryPointIndicesCount = entryPointIndices.getCount(); - - if (entryPointIndicesCount == 0 && compilerType == PassThroughMode::Dxc) + + // Whole program means + // * can have 0-N entry points + // * 'doesn't build into an executable/kernel' + // + // So in some sense it is a library + if (targetReq->isWholeProgramRequest()) { - // Can support no entry points on DXC because we can build libraries - profile = targetReq->getTargetProfile(); + if (compilerType == PassThroughMode::Dxc) + { + // Can support no entry points on DXC because we can build libraries + profile = targetReq->getTargetProfile(); + } + else + { + auto downstreamCompilerName = TypeTextUtil::getPassThroughName((SlangPassThrough)compilerType); + + sink->diagnose(SourceLoc(), Diagnostics::downstreamCompilerDoesntSupportWholeProgramCompilation, downstreamCompilerName); + return SLANG_FAIL; + } } else if (entryPointIndicesCount == 1) { @@ -1909,11 +1924,12 @@ void printDiagnosticArg(StringBuilder& sb, CodeGenTarget val) // The current logic of `emitEntryPoints` takes a list of entry-point indices to // emit code for, so we construct such a list first. List<Int> entryPointIndices; + m_entryPointResults.setCount(m_program->getEntryPointCount()); entryPointIndices.setCount(m_program->getEntryPointCount()); for (Index i = 0; i < entryPointIndices.getCount(); i++) entryPointIndices[i] = i; - + auto& result = m_wholeProgramResult; CodeGenContext::Shared sharedCodeGenContext(this, entryPointIndices, sink, endToEndReq); @@ -1929,7 +1945,7 @@ void printDiagnosticArg(StringBuilder& sb, CodeGenTarget val) DiagnosticSink* sink, EndToEndCompileRequest* endToEndReq) { - // It is possible that entry points goot added to the `Program` + // It is possible that entry points got added to the `Program` // *after* we created this `TargetProgram`, so there might be // a request for an entry point that we didn't allocate space for. // |
