A bit of confusion about SBT creation parameter passing(Using nv_helpers_dx12)

A bit of confusion about SBT creation parameter passing(Using nv_helpers_dx12)

Greetings!

I recently followed the DX12 Raytracing Tutorial to learn about DX12 ray tracing. Due to the good encapsulation of helper classes and the detailed explanations and comments in the tutorial, the learning process was relatively smooth, and I’d like to thank you for that!

However, while trying to modify the code for better understanding, there was one detail that confused me, specifically the call to m_sbtHelper.AddRayGenerationProgram() in the CreateShaderBindingTable() function.

m_sbtHelper.AddRayGenerationProgram(L"RayGen", {heapPointer});

According to the comment, the inputData parameter of this function corresponds to the parameter declared in the root signature, and the heapPointer passed in here in the tutorial is a pointer to the beginning of the descriptor heap. The point that confuses me is that changing this line of code to the following also works:

m_sbtHelper.AddRayGenerationProgram(L"RayGen", {});

How does this work?

Similarly, I added a texture (SRV) to the Hit shader root signature for access in the Shader, and when I called m_sbtHelper.AddHitGroup(L"HitGroup", {}), I also did not pass in the texture data pointer, but it can be read correctly in the Shader.

And how is this done?

Any replies are greatly appreciated, thanks!