This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

使用Mali T760通过clCreateContext创建OpenCL和OpenGL交互的cl context失败,返回CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR( -1000)

写了一个Android端OpenCL程序进行图片处理,涉及到OpenCL和OpenGL交互,所以定义了如下context_properties

cl_context_properties context_props[] = {
CL_CONTEXT_PLATFORM, (cl_context_properties) cl_objs.platform,
CL_GL_CONTEXT_KHR, (cl_context_properties) eglGetCurrentContext(),
CL_EGL_DISPLAY_KHR, (cl_context_properties) eglGetCurrentDisplay(),
0
};

然后调用
context = clCreateContext(context_props, 1, &device, NULL, NULL, &err)创建Context,但是返回CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR错误

使用的手机为Samsung SM-N9200, Mali-T760GPU,且能查到cl_khr_gl_sharing extension。在Mali GPU的手机上似乎都存在这个问题,而高通手机则一切正常,想知道究竟是什么原因呢?
Parents
  • Mali GPU 现在不支持CL和GL直接交互,如果需要通过交互,目前可以通过CL/EGL&GL/EGL。cl_khr_egl_image extension可以用来从EGLImage创建cl_image. 

    /* Create CL image from EGL image */

    *cl_image= clCreateFromEGLImageKHR( context, egl_display, *egl_image, mem_flags, 0, &err );

    /* Run program with CL image (using EGL backed memory) */

    clEnqueueAcquireEGLObjectsKHR( command_queue, 1, &cl_image, 0, NULL, NULL );

    clEnqueueNDRangeKernel( command_queue, kernel, 2, NULL, global_work_size, NULL, 0, NULL, NULL;

    clEnqueueReleaseEGLObjectsKHR( command_queue, 1, &cl_image, 0, NULL, NULL );

Reply
  • Mali GPU 现在不支持CL和GL直接交互,如果需要通过交互,目前可以通过CL/EGL&GL/EGL。cl_khr_egl_image extension可以用来从EGLImage创建cl_image. 

    /* Create CL image from EGL image */

    *cl_image= clCreateFromEGLImageKHR( context, egl_display, *egl_image, mem_flags, 0, &err );

    /* Run program with CL image (using EGL backed memory) */

    clEnqueueAcquireEGLObjectsKHR( command_queue, 1, &cl_image, 0, NULL, NULL );

    clEnqueueNDRangeKernel( command_queue, kernel, 2, NULL, global_work_size, NULL, 0, NULL, NULL;

    clEnqueueReleaseEGLObjectsKHR( command_queue, 1, &cl_image, 0, NULL, NULL );

Children