summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-hlsl.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2022-04-26 12:09:32 -0400
committerGitHub <noreply@github.com>2022-04-26 12:09:32 -0400
commit79dd12c21e8f5c5ce01051a280679cf6ac8ffe97 (patch)
tree705df0ab9047e4418a6218993cd0ddb2a46dffbc /source/slang/slang-emit-hlsl.cpp
parent66ad0072821b58318c6dc5d2d64c966e312951dd (diff)
Linking in DXC (#2190)
* #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. * Move slang-artifact into compiler-core. * Split out Keep free functions. * Artifact::Keep -> ArtifactKeep. * Handle libraries as artifacts. * Add -target dxil so test infrastructure knows it needs DXC. * Linking working in DXC. * Improve handling around emit for 'export'. * Add comment around Artifact name. * Render test working with linking. Co-authored-by: Theresa Foley <10618364+tangent-vector@users.noreply.github.com>
Diffstat (limited to 'source/slang/slang-emit-hlsl.cpp')
-rw-r--r--source/slang/slang-emit-hlsl.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/source/slang/slang-emit-hlsl.cpp b/source/slang/slang-emit-hlsl.cpp
index 059a3f641..03566f9df 100644
--- a/source/slang/slang-emit-hlsl.cpp
+++ b/source/slang/slang-emit-hlsl.cpp
@@ -739,14 +739,11 @@ void HLSLSourceEmitter::emitFuncDecorationImpl(IRDecoration* decoration)
const auto stage = profile.getStage();
const auto version = profile.getVersion();
- // I would perhaps ideally know that this was being compiled for 'library' stage.
- // Stage::Unknown is currently also used for lib profiles.
-
- // TODO(JS): Potentially can do export for fxc too, but for now we don't add.
-
- if (family == ProfileFamily::DX &&
- version >= ProfileVersion::DX_6_1 &&
- stage == Stage::Unknown)
+ // If it's whole program and it's for a late enough version of shader model
+ // output with 'export'
+ if (getTargetReq()->isWholeProgramRequest() &&
+ family == ProfileFamily::DX &&
+ version >= ProfileVersion::DX_6_1)
{
m_writer->emit("export\n");
}