Porting to OptiX 7

Are there any guides or advice to porting to OptiX 7 from earlier versions?

It’s really recommended to read all of the OptiX 7 documentation first. https://raytracing-docs.nvidia.com

If you take the OptiX SDK 7 examples as guide, there are quite a few examples which have been re-implemented from previous SDK versions.

The OptiX 7 API is completely different and the host code effectively requires a rewrite.

The shader code can be mostly reused after changes to the entry point names, then the previously context global variables are now in a user defined CUDA structure, the semantic variables are replaced with optix*() device functions, and the payload consist of up to 8 registers which allows to encode a 64-bit pointer into two of them if you need more data. That’s also shown in the examples.

The most crucial part to understand is the Shader Binding Table (SBT) in chapter 7. If you understood its possibilities that will open up many different options how to design ray tracing applications with OptiX 7. Especially important there is how the shader binding table index is calculated. That defines which ray can hit what program and sees what data.

The rest is all explicit: Loading and compiling modules with the device programs, building a pipeline from these, setting up geometry, building acceleration structures, getting traversable handles from that, and putting everything together in the SBT is shown in the various SDK examples.

You need to get used to the CUDA Runtime API or CUDA Driver API, because that’s how you work with OptiX 7. There is no CUDA interop anymore, everything is CUDA already. This, for example, allows to use native CUDA kernels on the same buffers you’re using in OptiX 7, or implement direct access to OpenGL texture images, copy data between GPUs, setup NVLINK peer-to-peer access, etc.

Overall it’s much more flexible than previous OptiX versions, but also puts more responsibility into the developer’s hands. Don’t let that deter you. It’s quite rewarding to find different solutions to a ray tracing problem and its performance is quite astounding.

Perfect, thank you for the explanation