summaryrefslogtreecommitdiff
path: root/source/slang
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang')
-rw-r--r--source/slang/slang-compiler.cpp2
-rwxr-xr-xsource/slang/slang-compiler.h3
-rw-r--r--source/slang/slang.cpp20
3 files changed, 23 insertions, 2 deletions
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp
index 1a4a12dfe..43a6d238e 100644
--- a/source/slang/slang-compiler.cpp
+++ b/source/slang/slang-compiler.cpp
@@ -1853,7 +1853,6 @@ namespace Slang
{
case ContainerFormat::SlangModule:
{
-
OwnedMemoryStream stream(FileAccess::Write);
SlangResult res = writeContainerToStream(&stream);
if (SLANG_FAILED(res))
@@ -1869,7 +1868,6 @@ namespace Slang
auto containerBlob = ListBlob::moveCreate(blobData);
m_containerArtifact = Artifact::create(ArtifactDesc::make(Artifact::Kind::CompileBinary, ArtifactPayload::SlangIR, ArtifactStyle::Unknown));
-
m_containerArtifact->addRepresentationUnknown(containerBlob);
return res;
diff --git a/source/slang/slang-compiler.h b/source/slang/slang-compiler.h
index 52d154e5c..0c366f485 100755
--- a/source/slang/slang-compiler.h
+++ b/source/slang/slang-compiler.h
@@ -2594,6 +2594,7 @@ namespace Slang
virtual SLANG_NO_THROW SlangResult SLANG_MCALL getTargetCodeBlob(int targetIndex, ISlangBlob** outBlob) SLANG_OVERRIDE;
virtual SLANG_NO_THROW SlangResult SLANG_MCALL getTargetHostCallable(int targetIndex, ISlangSharedLibrary** outSharedLibrary) SLANG_OVERRIDE;
virtual SLANG_NO_THROW void const* SLANG_MCALL getCompileRequestCode(size_t* outSize) SLANG_OVERRIDE;
+ virtual SLANG_NO_THROW ISlangMutableFileSystem* SLANG_MCALL getCompileRequestResultAsFileSystem() SLANG_OVERRIDE;
virtual SLANG_NO_THROW SlangResult SLANG_MCALL getContainerCode(ISlangBlob** outBlob) SLANG_OVERRIDE;
virtual SLANG_NO_THROW SlangResult SLANG_MCALL loadRepro(ISlangFileSystem* fileSystem, const void* data, size_t size) SLANG_OVERRIDE;
virtual SLANG_NO_THROW SlangResult SLANG_MCALL saveRepro(ISlangBlob** outBlob) SLANG_OVERRIDE;
@@ -2632,6 +2633,8 @@ namespace Slang
/// Where the container is stored. This is calculated as part of compile if m_containerFormat is set to
/// a supported format.
ComPtr<IArtifact> m_containerArtifact;
+ /// Holds the container as a file system
+ ComPtr<ISlangMutableFileSystem> m_containerFileSystem;
// Path to output container to
String m_containerOutputPath;
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 597e27bb9..4904abe03 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -13,6 +13,9 @@
#include "../compiler-core/slang-artifact-desc-util.h"
#include "../compiler-core/slang-artifact-util.h"
#include "../compiler-core/slang-artifact-associated-impl.h"
+#include "../compiler-core/slang-artifact-container-util.h"
+
+#include "../core/slang-memory-file-system.h"
#include "slang-module-library.h"
@@ -5234,6 +5237,23 @@ char const* EndToEndCompileRequest::getEntryPointSource(int entryPointIndex)
return (char const*)getEntryPointCode(entryPointIndex, nullptr);
}
+ISlangMutableFileSystem* EndToEndCompileRequest::getCompileRequestResultAsFileSystem()
+{
+ if (!m_containerFileSystem)
+ {
+ if (m_containerArtifact)
+ {
+ ComPtr<ISlangMutableFileSystem> fileSystem(new MemoryFileSystem);
+ if (SLANG_SUCCEEDED(ArtifactContainerUtil::writeContainer(m_containerArtifact, "", fileSystem)))
+ {
+ m_containerFileSystem.swap(fileSystem);
+ }
+ }
+ }
+
+ return m_containerFileSystem;
+}
+
void const* EndToEndCompileRequest::getCompileRequestCode(size_t* outSize)
{
if (m_containerArtifact)