OptiX 5 and 7 in the same application

Is it possible to use OptiX 5 and 7 in the same application, for comparing renders side-by-side while porting?

Not without changes to the headers. The top-level headers optix.h, optix_host.h and optix_device.h are named the same while they are completely different for OptiX 7.

The whole set of shader programs also needs to be disjunct.

Other than that the OptiX 5 core implementation resides inside the optix.5.1.x.dll and the OptiX 7 implementation is only headers with the core implementation inside the display driver so there is no overlap.

Care would need to be taken for the CUDA context handling. I’m not actually sure if OptiX 5 latches onto the current CUDA context or retains the primary one. In OptiX 7 the CUDA context handling is explicit and you are responsible to make the required context current if there are other modules using CUDA in your process.

Still I would rather use two separate versions of the same program. I’m doing that all the time, even for algorithmic changes to compare before and after.

Thank you, since it’s just for port testing we’ll keep thinks simple and have them separate then