Array Problem

Hi,

I’m trying to implement BPT in OPTIX. I need to save sampled path nodes in an array like this:
PathNode path[50];
Then, I tried to reference members in path with an index. But it seems I’m only allowed to provide an index that can be evaluated at compile time, such as path[9]. While I only got exception colors if I try to reference with arbitrary indices, say path, where x is computed at run time. Is this supported? If it is, what should I do to make it happen?

First, you should find out why you got the exception by decoding the exception code and printing the reason to the command line with an rtPrintf().

The standard reason would be insufficient stack size.
In that case incrase your stack size, but keep it as low as possible.

I assume you stored your path node array at your PerRayData payload. The payload will feed on that stack memory and also the bigger the payload the slower your performance might become, so don’t overdo it.

A path length of 50 seems big when you need to store the intermediate results. I would recommend to try to make it work with smaller lengths first.

If that is not helping, please always specify the configuration you’re reporting issues against:
OS version, bitness, installed GPU(s), display driver version, OptiX version, CUDA Toolkit version.

Thanks, it seems to be the stack size problem, I solved it by setting a larger stack size. b.t.w How can I print the cause of the exception with rtPrintf?

Please read the OptiX Programming Guide Chapter 4.4 Exception Programs.
For more information read the OptiX API Programming reference and search all device functions with “exception” in the name.
For working examples you should look into the OptiX SDK example source code. Many exception programs in there do that.