summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2024-01-03 10:55:27 -0500
committerGitHub <noreply@github.com>2024-01-03 10:55:27 -0500
commit62e45e7e611ba74d220bd9e227021cafdb67b559 (patch)
treebe4222b230524f6c311328667af70864536f45da /source
parentf33485c105b354a5a183732f47b9ca59c10ea08f (diff)
Fix issue with entry point result not being available via `spGetEntryPointCodeBlob` if defined in a serialized module. (#3431)
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 744033a0f..4921c9a7d 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -5620,7 +5620,12 @@ static SlangResult _getEntryPointResult(
}
auto targetReq = linkage->targets[targetIndex];
- Index entryPointCount = req->m_entryPoints.getCount();
+ // Get the entry point count on the program, rather than (say) req->m_entryPoints.getCount()
+ // because
+ // 1) The entry point is fetched from the program anyway so must be consistent
+ // 2) The req may not have all entry points (for example when an entry point is in a module)
+ const Index entryPointCount = program->getEntryPointCount();
+
if ((entryPointIndex < 0) || (entryPointIndex >= entryPointCount))
{
return SLANG_E_INVALID_ARG;