diff options
| author | Yong He <yonghe@outlook.com> | 2023-09-18 06:12:30 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-18 21:12:30 +0800 |
| commit | 8bcffcc085b996babedfeaee674c6ad09c9b08cf (patch) | |
| tree | 8e1537aca0a637c6d2a3b626f43a03fb4b085805 /source/slang | |
| parent | 95b470f810a5cecffee165635996fa908a38707f (diff) | |
Use direct spirv in hello-world example. (#3207)
* Use direct spirv in hello-world example.
* Use vulkan 1.1
* Use vulkan 1.2.
* fix.
* Fix test.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang')
| -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) |
