From 7cff340b10b27f82781335093759bbdc19cd2865 Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 21 Jan 2022 12:13:23 -0800 Subject: Add entry-point name override feature. (#2089) Co-authored-by: Yong He --- source/slang/slang.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source/slang/slang.cpp') 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* mangledEntryPointNames; + List* 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(); -- cgit v1.2.3