From 62e45e7e611ba74d220bd9e227021cafdb67b559 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 3 Jan 2024 10:55:27 -0500 Subject: Fix issue with entry point result not being available via `spGetEntryPointCodeBlob` if defined in a serialized module. (#3431) --- source/slang/slang.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source') 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; -- cgit v1.2.3