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-compiler.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-compiler.cpp') diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp index c1a768f02..d90e9b102 100644 --- a/source/slang/slang-compiler.cpp +++ b/source/slang/slang-compiler.cpp @@ -282,6 +282,14 @@ namespace Slang return m_mangledName; } + String EntryPoint::getEntryPointNameOverride(Index index) + { + SLANG_UNUSED(index); + SLANG_ASSERT(index == 0); + + return m_nameOverride; + } + void EntryPoint::acceptVisitor(ComponentTypeVisitor* visitor, SpecializationInfo* specializationInfo) { visitor->visitEntryPoint(this, as(specializationInfo)); @@ -1211,7 +1219,11 @@ namespace Slang // Set the entry point name options.entryPointName = getText(entryPoint->getName()); - + auto entryPointNameOverride = program->getEntryPointNameOverride(entryPointIndex); + if (entryPointNameOverride.getLength() != 0) + { + options.entryPointName = entryPointNameOverride; + } if (compilerType == PassThroughMode::Dxc) { // We will enable the flag to generate proper code for 16 - bit types -- cgit v1.2.3