I am using the CUDA runtime API. In my kernel file's host code I do the following:
unsigned char* pData = new unsigned char[2*256*256*256]();
glTexImage3D(
nTextureID, // created before (glBindTexture etc.)
0,
nInternalFormat, // GL_LUMINANCE_ALPHA
256,
256,
256,
0,
nDataFormat, // GL_LUMINANCE8_ALPHA8
nDataType, // GL_UNSIGNED_BYTE
pData);
/* ... still in OpenGL context ... */
cudaGraphicsResource* pGraphicResource = 0;
cudaError_t eError = cudaGraphicsGLRegisterImage(
&pGraphicResource,
nTextureID,
GL_TEXTURE_3D,
cudaGraphicsRegisterFlagsSurfaceLoadStore);
Whatever I do or change concerning the texture's format and/or data type I always get cudaErrorUnknown for eError. I can't believe that the error is because of chosing a wrong format, because the official documentation (external link) says, that all these formats are supported.
So my question to you: What other reasons may the cudaErrorUnknown have in this context?
By the way: I didn't use a call of cudaSetDevice or cudaGLSetGLDevice before. When I do so I get problems with "Runtime API error : all CUDA-capable devices are busy or unavailable". But I have proved that the index of the current device is the same and a valid one (my Quadro 600) before and after the call.
My GPU: NVIDIA Quadro 600 My SDK: NVIDIA CUDA Toolkit v4.1
unsigned char* pData = new unsigned char*[2*256*256*256]();is supposed to be? - talonmies()at the end, you want to allocate an array ofchar, not and array ofchar*, right? Also, do you ever callglBindTexture()? - harrism