Clarification needed for the payload type ID across different modules

In the Programming Guide, it says the payload type ID is the index of the optixPayloadType of optixModuleComplieOptions. It seems that the payload Type IDs are local to one module but not on a global pipeline level. Then what shall I set the payloadtypeID if we trace from one module and land in another module?

Here is an example: In the SDK examples, the radiance ray and shadow ray are in the same module; therefore, it has 2 payload types in the module and it is very clear. What if the radiance ray and the shadow ray are in different modules? Each module then only needs one payload type. Radiance Ray uses the payload type at index 0 in the radiance module while shadow ray uses the payload type at index 0 in the shadow module. If the radiance ray called optixTrace to trace a shadow ray, what would be the payload type ID? There is an ambiguity between payload type 0 in different modules. Is there a global payload ID index at the pipeline level that can distinguish the payload type IDs across different modules

Thanks!!

Hi @alston_xiao, welcome!

Yes the payload types are local to modules. This paragraph in the Programming Guide explains how to cross modules:

“Modules compiled with different payload types may be freely combined in a pipeline. While the maximum number of payload types per module is eight, the pipeline itself can exceed this limit due to the ability to link modules with disjoint payload types. […] Note that a user may assign matching payload types to different IDs in different modules. Payload types are considered to match if they agree on the number of payload values and the semantics of each value, irrespective of their IDs within a module.”

https://raytracing-docs.nvidia.com/optix7/guide/index.html#payload#payload


David.