Skip to content

Commit 525c2ac

Browse files
aleino-nvslangbotcsyonghe
authored
Improve entry point lookup function documentation (#6451)
* Document that findEntryPointByName is not applicable if there is no [shader(...)] attribute * Update the user guide to mention findAndCheckEntryPoint for entry points without [shader(...)] attributes * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
1 parent 60c5db5 commit 525c2ac

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

docs/user-guide/02-conventional-features.md

+1
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,7 @@ In this example, the `vertexMain` shader indicates that it is meant for the `ver
655655
Rasterization, compute, and ray-tracing pipelines each define their own stages, and new versions of graphics APIs may introduce new stages.
656656

657657
For compatibility with legacy codebases, Slang supports code that leaves off `[shader(...)]` attributes; in these cases application developers must specify the names and stages for their entry points via explicit command-line or API options.
658+
Such entry points will not be found via `IModule::findEntryPointByName()`. Instead `IModule::findAndCheckEntryPoint()` must be used, and a stage must be specified.
658659
It is recommended that new codebases always use `[shader(...)]` attributes both to simplify their workflow, and to make code more explicit and "self-documenting."
659660

660661
> #### Note ####

include/slang.h

+4
Original file line numberDiff line numberDiff line change
@@ -4361,6 +4361,10 @@ struct IModule : public IComponentType
43614361
{
43624362
SLANG_COM_INTERFACE(0xc720e64, 0x8722, 0x4d31, {0x89, 0x90, 0x63, 0x8a, 0x98, 0xb1, 0xc2, 0x79})
43634363

4364+
/// Find and an entry point by name.
4365+
/// Note that this does not work in case the function is not explicitly designated as an entry
4366+
/// point, e.g. using a `[shader("...")]` attribute. In such cases, consider using
4367+
/// `IModule::findAndCheckEntryPoint` instead.
43644368
virtual SLANG_NO_THROW SlangResult SLANG_MCALL
43654369
findEntryPointByName(char const* name, IEntryPoint** outEntryPoint) = 0;
43664370

0 commit comments

Comments
 (0)