summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-compiler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-compiler.cpp')
-rw-r--r--source/slang/slang-compiler.cpp50
1 files changed, 40 insertions, 10 deletions
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp
index 74075bb51..ba2ad1dd8 100644
--- a/source/slang/slang-compiler.cpp
+++ b/source/slang/slang-compiler.cpp
@@ -250,6 +250,7 @@ namespace Slang
funcDeclRef.GetName(),
profile,
funcDeclRef);
+ entryPoint->m_mangledName = getMangledName(funcDeclRef);
return entryPoint;
}
@@ -266,6 +267,21 @@ namespace Slang
return entryPoint;
}
+ RefPtr<EntryPoint> EntryPoint::createDummyForDeserialize(
+ Linkage* linkage,
+ Name* name,
+ Profile profile,
+ String mangledName)
+ {
+ RefPtr<EntryPoint> entryPoint = new EntryPoint(
+ linkage,
+ name,
+ profile,
+ DeclRef<FuncDecl>());
+ entryPoint->m_mangledName = mangledName;
+ return entryPoint;
+ }
+
EntryPoint::EntryPoint(
Linkage* linkage,
Name* name,
@@ -338,16 +354,7 @@ namespace Slang
SLANG_UNUSED(index);
SLANG_ASSERT(index == 0);
- // Note: this routine might get called on the "dummy"
- // `EntryPoint` objects we create when doing pass-through
- // compilation, in which case there won't be any
- // function decl to be referenced and thus have
- // its mangled name computed.
- //
- if(auto funcDeclRef = getFuncDeclRef())
- return getMangledName(funcDeclRef);
- else
- return String();
+ return m_mangledName;
}
void EntryPoint::acceptVisitor(ComponentTypeVisitor* visitor, SpecializationInfo* specializationInfo)
@@ -2255,6 +2262,29 @@ SlangResult dissassembleDXILUsingDXC(
SLANG_RETURN_ON_FAIL(writer.write(irModule, sourceManager, optionFlags, &serialData));
SLANG_RETURN_ON_FAIL(IRSerialWriter::writeContainer(serialData, compressionType, &container));
}
+
+ auto entryPointCount = program->getEntryPointCount();
+ for( Index ii = 0; ii < entryPointCount; ++ii )
+ {
+ auto entryPoint = program->getEntryPoint(ii);
+ auto entryPointMangledName = program->getEntryPointMangledName(ii);
+
+ RiffContainer::ScopeChunk entryPointScope(&container, RiffContainer::Chunk::Kind::Data, IRSerialBinary::kEntryPointFourCc);
+
+ auto writeString = [&](String const& str)
+ {
+ uint32_t length = (uint32_t) str.getLength();
+ container.write(&length, sizeof(length));
+ container.write(str.getBuffer(), length+1);
+ };
+
+ writeString(entryPoint->getName()->text);
+
+ Profile profile = entryPoint->getProfile();
+ container.write(&profile, sizeof(profile));
+
+ writeString(entryPointMangledName);
+ }
}
// We now write the RiffContainer to the stream