[Resolved] Invalid value (Details: Function "_rtContextLaunch2D" caught exception: Graphics resource must be the same size as OptiX buffer)

Hi,

I have an application that worked as expected using Optix 3.8 and CUDA 7.5. I upgraded to CUDA 8 and Optix 4.0.2 and I’m getting this exception when calling launch for an optix context.

Invalid value (Details: Function “_rtContextLaunch2D” caught exception: Graphics resource must be the same size as OptiX buffer)

Before calling launch I call validate and get no exception.

The code was running with no issues on Otpix 3.8, but I assume that I was already doing something wrong, and the new version provides stronger validation.

I checked all calls to createBufferFromGLBO and respective setsize and they all seem to be correct (I’m using setsize to pass the number of elements, not the number of bytes). All the calls to createBufferFromGLBO are inside a try-catch and no exceptions are thrown there.

Can you provide me with a clue on where to look for the issue?

Thanks in advance,

António

Solved. The bug was in my OpenGL side of the app. I was creating the texture using the number of bits, not bytes :-(

I was expecting that this problem would raise an exception during Optix’s buffer creation so I didn’t check it.

António

Yeah, this is because buffers are allocated on the GPU(s) at launch time, not at buffer creation time. This allows potential optimizations like skipping allocation for buffers that aren’t really ever used.

Thanks for following up, btw. Marking this resolved.