diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-ir-glsl-legalize.cpp | 19 | ||||
| -rw-r--r-- | source/slang/slang-ir-insts.h | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/source/slang/slang-ir-glsl-legalize.cpp b/source/slang/slang-ir-glsl-legalize.cpp index 866fd3a4d..b94afe611 100644 --- a/source/slang/slang-ir-glsl-legalize.cpp +++ b/source/slang/slang-ir-glsl-legalize.cpp @@ -2634,6 +2634,18 @@ void legalizeEntryPointParameterForGLSL( } } +bool shouldUseOriginalEntryPointName(CodeGenContext* codeGenContext) +{ + if (auto hlslOptions = codeGenContext->getTargetReq()->getHLSLToVulkanLayoutOptions()) + { + if (hlslOptions->getUseOriginalEntryPointName()) + { + return true; + } + } + return false; +} + void legalizeEntryPointForGLSL( Session* session, IRModule* module, @@ -2679,6 +2691,13 @@ void legalizeEntryPointForGLSL( context.builder = &builder; + // Rename the entrypoint to "main" to conform to GLSL standard, + // if the compile options require us to do it. + if (!shouldUseOriginalEntryPointName(codeGenContext)) + { + entryPointDecor->setName(builder.getStringValue(UnownedStringSlice("main"))); + } + // We will start by looking at the return type of the // function, because that will enable us to do an // early-out check to avoid more work. diff --git a/source/slang/slang-ir-insts.h b/source/slang/slang-ir-insts.h index d8788aa06..b88df524a 100644 --- a/source/slang/slang-ir-insts.h +++ b/source/slang/slang-ir-insts.h @@ -454,6 +454,7 @@ struct IREntryPointDecoration : IRDecoration IRStringLit* getName() { return cast<IRStringLit>(getOperand(1)); } IRStringLit* getModuleName() { return cast<IRStringLit>(getOperand(2)); } + void setName(IRStringLit* name) { setOperand(1, name); } }; IR_SIMPLE_DECORATION(CudaHostDecoration) |
