Yes, that should just work, unless you did anything with strings, because there can be null characters inside the binary *.optixir.
So if you didn’t also adjust the optixModuleCreate
function arguments throughout the code to not use things like ptxCode.c_str()
, this ain’t working.
And of course the OptiX IR needs to be generated with a CUDA toolkit version which is supported by the installed display driver, or you get errors like this: https://forums.developer.nvidia.com/t/optix-8-module-creation-version-mismatch/272885
For faster compile turnaround times in my OptiX examples, I’m not embedding OptiX module input files but simply store them into an application specific folder relative to the executable and load them as binary from there. This code is not using strings to handle either PTX or OptiX IR input code!
https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/MDL_renderer/src/Device.cpp#L721
The OptiX SDK 8.0.0 has some CMake macros using BIN2C as well. I don’t know if that is actually used, yet.