summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-08-07 15:04:34 -0700
committerGitHub <noreply@github.com>2023-08-07 15:04:34 -0700
commitae1c9d9825b5e672f64277f13b3c6a6d4a5155c3 (patch)
treeeb8c4afb231a03679373bb6b19e3e5613ee591b1 /source
parent3a9624040d3a3395d855caaa4358a9ff1fbcca3b (diff)
Fix -fvk-use-entrypoint-name. (#3066)
* Fix -fvk-use-entrypoint-name. * Remove irrelevant changes. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source')
-rw-r--r--source/slang-glslang/slang-glslang.cpp2
-rw-r--r--source/slang/slang-compiler.cpp17
-rw-r--r--source/slang/slang-hlsl-to-vulkan-layout-options.cpp2
3 files changed, 14 insertions, 7 deletions
diff --git a/source/slang-glslang/slang-glslang.cpp b/source/slang-glslang/slang-glslang.cpp
index b23a34e65..92a8d753b 100644
--- a/source/slang-glslang/slang-glslang.cpp
+++ b/source/slang-glslang/slang-glslang.cpp
@@ -607,7 +607,7 @@ static int glslang_compileGLSLToSPIRV(const glslang_CompileRequest_1_2& request)
return 1;
}
- if (request.entryPointName)
+ if (request.entryPointName && strlen(request.entryPointName))
shader->setEntryPoint(request.entryPointName);
program->addShader(shader);
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp
index 12e96d7bb..afc7899a8 100644
--- a/source/slang/slang-compiler.cpp
+++ b/source/slang/slang-compiler.cpp
@@ -938,6 +938,17 @@ namespace Slang
return desc.style == ArtifactStyle::Host;
}
+ static bool _shouldSetEntryPointName(TargetRequest* targetReq)
+ {
+ if (!isKhronosTarget(targetReq))
+ return true;
+ if (!targetReq->getHLSLToVulkanLayoutOptions())
+ return false;
+ if (targetReq->getHLSLToVulkanLayoutOptions()->getUseOriginalEntryPointName())
+ return true;
+ return false;
+ }
+
SlangResult CodeGenContext::emitWithDownstreamForEntryPoints(ComPtr<IArtifact>& outArtifact)
{
outArtifact.setNull();
@@ -1222,12 +1233,8 @@ namespace Slang
auto entryPoint = getEntryPoint(entryPointIndex);
profile = getEffectiveProfile(entryPoint, targetReq);
- if (getTargetReq()->getHLSLToVulkanLayoutOptions() && !getTargetReq()->getHLSLToVulkanLayoutOptions()->getUseOriginalEntryPointName())
+ if (_shouldSetEntryPointName(getTargetReq()))
{
- }
- else
- {
-
options.entryPointName = allocator.allocate(getText(entryPoint->getName()));
auto entryPointNameOverride = getProgram()->getEntryPointNameOverride(entryPointIndex);
if (entryPointNameOverride.getLength() != 0)
diff --git a/source/slang/slang-hlsl-to-vulkan-layout-options.cpp b/source/slang/slang-hlsl-to-vulkan-layout-options.cpp
index 1c0e0858b..1a56be3d9 100644
--- a/source/slang/slang-hlsl-to-vulkan-layout-options.cpp
+++ b/source/slang/slang-hlsl-to-vulkan-layout-options.cpp
@@ -91,7 +91,7 @@ Index HLSLToVulkanLayoutOptions::getShift(Kind kind, Index set) const
bool HLSLToVulkanLayoutOptions::hasState() const
{
- return canInferBindings() || hasGlobalsBinding() || shouldInvertY();
+ return canInferBindings() || hasGlobalsBinding() || shouldInvertY() || getUseOriginalEntryPointName();
}
HLSLToVulkanLayoutOptions::Binding HLSLToVulkanLayoutOptions::inferBinding(Kind kind, const Binding& inBinding) const