I’ve removed the error checks to make it easier to read.
The bufferPtr has previously been cudaMalloc’d and then cudaMemcpy’d in the previously mentioned CUDA code.
Upon running this code, rtBufferSetDevicePointer causes 2 first-chance exceptions:
Microsoft C++ exception: optix::GLContextCreateError at memory location
Microsoft C++ exception: cudaError at memory location
however this does not cause the function call to return an error (or halt my program).
This later upon the rtContextLaunch call causes another exception, and returns an error
Microsoft C++ exception: optix::CudaError at memory location
The error text returned is: Unknown error (Details: Function “_rtContextLaunch2D” caught exception: Encountered a CUDA error: cuGLGetDevices() returned (999): Unknown, [3801440])HELP
Sounds like you’re running into some issues related to CUDA interop and GL interop not playing nicely together. I know we’ve fixed a number of issues related to CUDA interop since beta 1; please contact me privately and I’ll see about getting you the latest OptiX 3.0 build to see if this is still a bug.
And I get this error after: ERROR CHECK ---------> cannot set while device is active in this process
Which is happening at the rtBufferSetDevicePointer call. Am I getting device pointers incorrectly or recasting them to CUdeviceptr incorrectly? Or does the problem have to do with the order I initialize things? I make a CUDA context by doing cudaMemcpy a few times before I do an OptiX things. It seems like OptiX cannot latch onto the existing CUDA context…