Using Multiple Closest Hit Shaders


I’m reading both the Vukan Raytracing Tutorial (url) and the Vulkan documentation (url) and they both state that Vulkan supports any amount of closest hit shaders. However, I can’t find how the extension allows it.

With miss shaders, for example, we can have several in the same group in the SBT and then select which one to execute in the traceRayEXT() function. But there is no way to select which chit shader to execute when intersecting with the closest triangle.

My guess would be to switch pipelines or calling vkCmdTraceRaysKHR for every different chit shader that we want to use. However, this last method seems quite inefficient.

Is there any other way (or a “best way”) to do this?