cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

jstier
Journeyman III

clCreateFromGLBuffer from OpenGL array buffer

error when creating a clBuffer from an GL_ARRAY_BUFFER

Hi,

It does not seem to be possible to create a clBuffer from an OpenGL array buffer like so:

glGenBuffers(1, &mGLBuffer);

glBindBuffer(GL_ARRAY_BUFFER, mGLBuffer);



glBufferData(GL_ARRAY_BUFFER, 128*128*sizeof(cl_float4), NULL, GL_DYNAMIC_DRAW);

glBindBuffer(GL_ARRAY_BUFFER, 0);

 





mCLBuffer = clCreateFromGLBuffer(sContextCL, CL_MEM_READ_WRITE, mGLBuffer, &sStatusCL);

 



The call from clCreateFromGLBuffer returns an error of CL_INVALID_GL_OBJECT. I am not sure if this is supposed to be possible according to the specs, it does however work with the NVIDIA driver. Am I missing something ? I am not sure, but I would bet this worked in a previous driver version ... but I am not 100% sure

I am running the latest XP driver with a HD 5830.

 

0 Likes
7 Replies
himanshu_gautam
Grandmaster

jstier,

Please specify your system configuration: SDK,DRIVER,GL version.

Are you able to run other gl related samples from SDK? Refer them.

If problem persists try to send a small testcase which can reproduce the issue.

0 Likes

I found the problem. If a framebuffer is bound, then a call to clCreateFromGLBuffer fails. You can easily reproduce this using the SimpleGL sample in the latest App SDK. Before line 745 of SimpleGL.cpp insert the following three lines of code and clCreateFromGLBuffer will return 0; at least on my system with an HD5830 and latest App SDK installed

GLuint mFrameBO;  

glGenFramebuffersEXT(1, &mFrameBO); 

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFrameBO);



 

Obviously I found an easy workaround but maybe your devs are still interested in the problem.



0 Likes

Originally posted by: jstier I found the problem. If a framebuffer is bound, then a call to clCreateFromGLBuffer fails. You can easily reproduce this using the SimpleGL sample in the latest App SDK. Before line 745 of SimpleGL.cpp insert the following three lines of code and clCreateFromGLBuffer will return 0; at least on my system with an HD5830 and latest App SDK installed

 

GLuint mFrameBO;   glGenFramebuffersEXT(1, &mFrameBO); 

 

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFrameBO);

 

 

 

 

Obviously I found an easy workaround but maybe your devs are still interested in the problem.

 

 



Jstier,

         Is it working in Nvidia device?

0 Likes

Yes, this is working with an NVIDIA device. I am also fairly sure this has worked on a previous version of AMD drivers. I am just trying out our App on the latest AMD drivers, which we haven't done in a while. There are still a few other problems, but I have to investigate more before I can report on them. In any case, this particular problem is easily solved by creating the OpenCL buffer after the framebuffer has been unmapped.

0 Likes

Thanks jstier,

I have reported this to Developer Team.

0 Likes

Hello;

 

I'd just like some more information about whether the issue has been resolved (or when to expect it to).

 

Thanks

0 Likes

if they fixed it today you can execept fix in three months when they release new driver.

0 Likes