CL-GL-Interop: clEnqueueAcquireGLObjects fails!

CL-GL-Interop: clEnqueueAcquireGLObjects fails!

Hi,

I am trying to set up a CL-GL project.
Everything works fine up to the point where I want to use the GL-Buffer within CL.

Is this an issue with my code or with sys system specs?

Thank you!

System:
i5-2500 CPU (OpenCL 1.1 (Build 30316.30328))
Integrated Intel HD2000 Graphics (OpenGL 3.1.0 - Build 8.15.10.2696)

What I did:

//GL is set-up and is running
//CL is set-up with CL_GL_CONTEXT_KHR and CL_WGL_HDC_KHR and is running
//Context: CL_DEVICE_TYPE_CPU
//Loaded Texture with

glGenTextures(1, &texture);

glBindTexture(GL_TEXTURE_2D, texture);

glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );

glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);

//Texture is successfully rended on Screen!
//Created CL-Image with

cl::Image2DGL imageIn(context, CL_MEM_READ_ONLY, GL_TEXTURE_2D, 0, texture);

//Success!!
//Using Texture in CL with

glFlush();

glFinish();

VECTOR_CLASS mem_objects(1);

mem_objects.push_back(imageIn);

queue.enqueueAcquireGLObjects(&mem_objects, NULL, &event);

//FAILS WITH: -38 CL_INVALID_MEM_OBJECT
//glGetError() returns 0 at any point of this code!

publicaciones de 2 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

It works now:

//With these already *successfully* initialised variables

cl::CommandQueue queue(context, devices[0], 0, &err);

cl::Image2DGL imageIn(context, CL_MEM_READ_ONLY, GL_TEXTURE_2D, 0, texture);
//Doing the following works now

VECTOR_CLASS* mem_objects = new VECTOR_CLASS();

mem_objects->push_back(imageIn);

queue.enqueueAcquireGLObjects(mem_objects);
Maybe it might help someone else ;)

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya