From 2e08f33386b65502e16eea33613bddf98ab8b440 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 14 Oct 2024 10:06:16 -0700 Subject: Fix assert when compiling an entrypoint that calls another entrypoint. (#5268) * Fix assert when compiling an entrypoint that calls another entrypoint. * Fix test. --- source/slang/slang-ir-entry-point-uniforms.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/slang/slang-ir-entry-point-uniforms.cpp b/source/slang/slang-ir-entry-point-uniforms.cpp index a269ec171..aa327caf6 100644 --- a/source/slang/slang-ir-entry-point-uniforms.cpp +++ b/source/slang/slang-ir-entry-point-uniforms.cpp @@ -200,8 +200,15 @@ struct CollectEntryPointUniformParams : PerEntryPointPass // defensive and bail out in the failure case in release builds. // auto funcLayoutDecoration = entryPointFunc->findDecoration(); - SLANG_ASSERT(funcLayoutDecoration); - if(!funcLayoutDecoration) + + // If the module contains two functions with entrypoint decorations, + // and one entrypoint calls the other entrypoint, and the user + // tells us to compile the caller entrypoint but not the callee + // entrypoint, we will not have the layout decoration created for + // the callee entrypoint. In this case, we should simply treat the + // callee entrypoint as if it is an ordinary function and skip the + // rest of the logic here. + if (!funcLayoutDecoration) return; auto entryPointLayout = as(funcLayoutDecoration->getLayout()); -- cgit v1.2.3