rtPrintf in intersection functions

Hello,

last days I was debugging my code cause the rays are missing every object I add to the context.
My problem is that I can’t add a “rtPrintf” to the intersection functions.

Adding

rtPrintf("Ray: (%f, %f, %f)\n", ray.origin.x, ray.origin.y, ray.origin.z);

to “intersect” function in “sphere.cu” results in a context compile error:

terminate called after throwing an instance of 'optix::Exception'
  what():  Invalid value (Details: Function "_rtContextCompile" caught exception: Error locating PTX Symbol: $str, [1049181])

Is there any solution for this problem?

Best
RoboMod

I don’t see any issue with this. Did you call setPrintEnabled ?

_context->setPrintEnabled(1);

Yes, setPrintEnabled is set to “true”. I can do a rtPrintf in other functions. Only the intersection functions throw these errors.

I tried the same for the whitted example, it seems to be working fine for me. Try modifying the whitted example in the sdk, and see if you get the same issue again. If not, the issue might be related to something else.

Yes, there was a bug with printing inside of intersection programs (namely references to these global variables that contain the string literal). It should be fixed in 3.0.1. Please make sure you are using the latest version.

Thank you so much! Switching to the latest release fixed my problem. Now I can debug the intersection, tank you.

Best
RoboMod