Failed to call clEnqueueCopyImage between src(clCreateFromEGLImageKHR) and dst(clCreateImage)

Recently, I tried to use clEnqueueCopyImage for OpenGL/ES interop with OpenCL. However, it just return -59(CL_INVALID_OPERATION) after calling clEnqueueCopyImage

  1. Use glGenTextures to generate input_gl_tex and check( glGetError() )
  2. Use eglCreateImageKHR to generate input_egl_image with input_gl_tex as parameter and check( eglGetError() )
  3. Use clCreateFromEGLImageKHR to generate input_cl_egl_image with input_egl_image as parameter and check
  4. Use clEnqueueAcquireEGLObjectsKHR to acquire for input_cl_egl_image
  5. Use clEnqueuecopImage  between src(input_cl_egl_image) and dst(clCreateImage), it just return CL_INVALID_OPERATION

How could i fix it ?

Parents
  • Hello,

    I'm afraid older drivers do not support imported images as the source of image copy commands. This restriction is being relaxed for several types of memory and we will make sure that your usage scenario is tested going forward.

    Taking a step back: do you really need to make a copy? Imported EGL images can be accessed directly from kernels and getting rid of the copy would give you better performance. If you do need the copy on current drivers in that exact scenario, a reasonable workaround could be to write a simple kernel that performs the copy. It could be as simple as: read one pixel from the source image in each work-item and write that pixel to the destination image.

    Hope this helps and don't hesitate if you need more help!

    Regards,

    Kevin

Reply
  • Hello,

    I'm afraid older drivers do not support imported images as the source of image copy commands. This restriction is being relaxed for several types of memory and we will make sure that your usage scenario is tested going forward.

    Taking a step back: do you really need to make a copy? Imported EGL images can be accessed directly from kernels and getting rid of the copy would give you better performance. If you do need the copy on current drivers in that exact scenario, a reasonable workaround could be to write a simple kernel that performs the copy. It could be as simple as: read one pixel from the source image in each work-item and write that pixel to the destination image.

    Hope this helps and don't hesitate if you need more help!

    Regards,

    Kevin

Children