summaryrefslogtreecommitdiff
path: root/source/compiler-core/slang-dxc-compiler.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2022-04-27 17:53:21 -0400
committerGitHub <noreply@github.com>2022-04-27 17:53:21 -0400
commit634f5414f332f904c7db968810b3d6f0ca253959 (patch)
treec5747ca337e21ce74cc5997722b19a94604fe4aa /source/compiler-core/slang-dxc-compiler.cpp
parentec530b300524635dfe0fd86949b0a4fc5c19a984 (diff)
Make artifact an interface (#2195)
* #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. * Improvements around Artifact handling. * Add ArtifactPayloadInfo. * Small tidy up around artifact. * Split out code to get info about Artifacts into artifact-info.cpp/.h * IArtifact interface and IArtifactInstance interface. * Fix small issues. * Fix compilation warning issue. * Fix missing SLANG_OVERRIDE. * Small fixes to make compilation work on Visual Studio 2022. * Small improvements to Artifact interface/naming. * Added Desc with each element in IArchive to allow more flexibility in usage. * Fix clang warning issue. * Add ArtifactPayload::Diagnostics * More discussion around IArtifact usage. * Re-add slang-artifact.h which was removed during merge. * Fix typo identified in review.
Diffstat (limited to 'source/compiler-core/slang-dxc-compiler.cpp')
-rw-r--r--source/compiler-core/slang-dxc-compiler.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/source/compiler-core/slang-dxc-compiler.cpp b/source/compiler-core/slang-dxc-compiler.cpp
index 0d05bf724..6375ba23a 100644
--- a/source/compiler-core/slang-dxc-compiler.cpp
+++ b/source/compiler-core/slang-dxc-compiler.cpp
@@ -19,6 +19,8 @@
#include "../core/slang-shared-library.h"
+#include "../compiler-core/slang-artifact-info.h"
+
// Enable calling through to `dxc` to
// generate code on Windows.
#ifdef _WIN32
@@ -79,9 +81,9 @@ static UnownedStringSlice _addName(const UnownedStringSlice& inSlice, StringSlic
}
}
-static UnownedStringSlice _addName(Artifact* artifact, StringSlicePool& pool)
+static UnownedStringSlice _addName(IArtifact* artifact, StringSlicePool& pool)
{
- return _addName(artifact->getBaseName().getUnownedSlice(), pool);
+ return _addName(ArtifactInfoUtil::getBaseName(artifact).getUnownedSlice(), pool);
}
class DxcIncludeHandler : public IDxcIncludeHandler
@@ -288,8 +290,8 @@ SlangResult DXCDownstreamCompiler::compile(const CompileOptions& options, RefPtr
}
// Find all of the libraries
- List<Artifact*> libraries;
- for (Artifact* library : options.libraries)
+ List<IArtifact*> libraries;
+ for (IArtifact* library : options.libraries)
{
const auto desc = library->getDesc();
@@ -297,7 +299,7 @@ SlangResult DXCDownstreamCompiler::compile(const CompileOptions& options, RefPtr
{
// Make sure they all have blobs
ComPtr<ISlangBlob> libraryBlob;
- SLANG_RETURN_ON_FAIL(library->loadBlob(ArtifactKeep::Yes, libraryBlob));
+ SLANG_RETURN_ON_FAIL(library->loadBlob(ArtifactKeep::Yes, libraryBlob.writeRef()));
libraries.add(library);
}
@@ -462,10 +464,10 @@ SlangResult DXCDownstreamCompiler::compile(const CompileOptions& options, RefPtr
List<ComPtr<ISlangBlob>> libraryBlobs;
List<OSString> libraryNames;
- for (Artifact* library : libraries)
+ for (IArtifact* library : libraries)
{
ComPtr<ISlangBlob> blob;
- SLANG_RETURN_ON_FAIL(library->loadBlob(ArtifactKeep::Yes, blob));
+ SLANG_RETURN_ON_FAIL(library->loadBlob(ArtifactKeep::Yes, blob.writeRef()));
libraryBlobs.add(blob);
libraryNames.add(String(_addName(library, pool)).toWString());