summaryrefslogtreecommitdiff
path: root/source/slang/slang.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-01-21 12:13:23 -0800
committerGitHub <noreply@github.com>2022-01-21 12:13:23 -0800
commit7cff340b10b27f82781335093759bbdc19cd2865 (patch)
tree15a983c4fdfb68b700ab532d5d2a684e8727e6b4 /source/slang/slang.cpp
parentf85bc7ae98486b37518958e659f659f1ff9b125c (diff)
Add entry-point name override feature. (#2089)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang.cpp')
-rw-r--r--source/slang/slang.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 5fbc5b4bf..1333e3660 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -3325,6 +3325,7 @@ CompositeComponentType::CompositeComponentType(
{
m_entryPoints.add(child->getEntryPoint(cc));
m_entryPointMangledNames.add(child->getEntryPointMangledName(cc));
+ m_entryPointNameOverrides.add(child->getEntryPointNameOverride(cc));
}
auto childShaderParamCount = child->getShaderParamCount();
@@ -3376,6 +3377,11 @@ String CompositeComponentType::getEntryPointMangledName(Index index)
return m_entryPointMangledNames[index];
}
+String CompositeComponentType::getEntryPointNameOverride(Index index)
+{
+ return m_entryPointNameOverrides[index];
+}
+
Index CompositeComponentType::getShaderParamCount()
{
return m_shaderParams.getCount();
@@ -3783,6 +3789,7 @@ SpecializedComponentType::SpecializedComponentType(
struct EntryPointMangledNameCollector : ComponentTypeVisitor
{
List<String>* mangledEntryPointNames;
+ List<String>* entryPointNameOverrides;
void visitEntryPoint(EntryPoint* entryPoint, EntryPoint::EntryPointSpecializationInfo* specializationInfo) SLANG_OVERRIDE
{
@@ -3791,6 +3798,7 @@ SpecializedComponentType::SpecializedComponentType(
funcDeclRef = specializationInfo->specializedFuncDeclRef;
(*mangledEntryPointNames).add(getMangledName(m_astBuilder, funcDeclRef));
+ (*entryPointNameOverrides).add(entryPoint->getEntryPointNameOverride(0));
}
void visitModule(Module*, Module::ModuleSpecializationInfo*) SLANG_OVERRIDE
@@ -3815,6 +3823,7 @@ SpecializedComponentType::SpecializedComponentType(
//
EntryPointMangledNameCollector collector(getLinkage()->getASTBuilder());
collector.mangledEntryPointNames = &m_entryPointMangledNames;
+ collector.entryPointNameOverrides = &m_entryPointNameOverrides;
collector.visitSpecialized(this);
}
@@ -3840,6 +3849,11 @@ String SpecializedComponentType::getEntryPointMangledName(Index index)
return m_entryPointMangledNames[index];
}
+String SpecializedComponentType::getEntryPointNameOverride(Index index)
+{
+ return m_entryPointNameOverrides[index];
+}
+
void ComponentTypeVisitor::visitChildren(CompositeComponentType* composite, CompositeComponentType::CompositeSpecializationInfo* specializationInfo)
{
auto childCount = composite->getChildComponentCount();