Results 1 to 4 of 4

Thread: Problem with GL-CL sharing context

  1. #1
    Junior Member
    Join Date
    Feb 2011
    Posts
    5

    Problem with GL-CL sharing context

    Hi all !

    I'm actually experiencing some troubles with the cl_gl sharing extension. I'm on windows 7, developping under Qt Creator (4.7) and using the nvidia OpenCL 1.0 (CUDA 3.2.1 driver). I also installed the Intel OpenCL 1.1 driver.

    My program crashed when i try to create a CL image object from a GL texture object; the error is CL_INVALID_CONTEXT.
    When i checked for errors when creating context (with clCreateContext), i saw this :
    • I've got a VALID GL context (
      Code :
      QGLContext::currentContext() != 0
      );[/*:m:14kpthuk]
    • I use
      Code :
      wglGetCurrentDC() for CL_WGL_HDC_KHR and wglGetCurrentContext() for CL_GL_CONTEXT_KHR
      when passing to the properties ;[/*:m:14kpthuk]
    • When i list all the CL devices "which may be associated with the specified OpenGL context" using clGetGLContextInfoKHR and param_name CL_DEVICES_FOR_GL_CONTEXT_KHR, the returned value is 0 but i query for CL_DEVICES_FOR_GL_CONTEXT_KHR, the size is equal to 1 ?[/*:m:14kpthuk]
    • Finally, when the code execute "clCreateContext" with the correct params, it returns the error code "-59" which corresponds to "CL_INVALID_OPERATION" (source : cl.h) but it listed nowhere in the specs ??[/*:m:14kpthuk]


    Could someone give me some hints about that.

    Thanks !

  2. #2
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: Problem with GL-CL sharing context

    When i list all the CL devices "which may be associated with the specified OpenGL context" using clGetGLContextInfoKHR and param_name CL_DEVICES_FOR_GL_CONTEXT_KHR, the returned value is 0 but i query for CL_DEVICES_FOR_GL_CONTEXT_KHR, the size is equal to 1 ?
    I don't understand that sentence. Could you rephrase it?

    Finally, when the code execute "clCreateContext" with the correct params, it returns the error code "-59" which corresponds to "CL_INVALID_OPERATION" (source : cl.h) but it listed nowhere in the specs ??
    Yeah, that's a bug. clCreateContext() should never return CL_INVALID_OPERATION.

    Have you checked that GL/CL sharing is actually supported? Is "cl_khr_gl_sharing" exposed in clGetDeviceInfo(CL_DEVICE_EXTENSIONS)?
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

  3. #3
    Junior Member
    Join Date
    Feb 2011
    Posts
    5

    Re: Problem with GL-CL sharing context

    When i list all the CL devices "which may be associated with the specified OpenGL context" using clGetGLContextInfoKHR and param_name CL_DEVICES_FOR_GL_CONTEXT_KHR, the returned value is 0 but i query for CL_DEVICES_FOR_GL_CONTEXT_KHR, the size is equal to 1 ?

    Could you rephrase it?
    I mean that when i execute the function clGetGLContextInfoKHR to get the number of devices that are associated with an OpenGL context, i get no devices at all with the param_name CL_DEVICES_FOR_GL_CONTEXT_KHR but i get 1 device with the param_name CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR !

    Have you checked that GL/CL sharing is actually supported? Is "cl_khr_gl_sharing" exposed in clGetDeviceInfo(CL_DEVICE_EXTENSIONS)?
    Yeah, i check this and it's supported by my CL device (checked with clGetDeviceInfo()).

  4. #4
    Junior Member
    Join Date
    Feb 2011
    Posts
    5

    Re: Problem with GL-CL sharing context

    By the way when i create a CL image object (2D) with the Order "RGB" and Type "Normalized_UInt8" (with the flag READ_WRITE), the function clEnqueueWriteImage returns "CL_OUT_OF_RESOURCES" but when i use Order "RGBA", there's not error at all ?!

Similar Threads

  1. Context sharing and lifetime
    By pjcozzi in forum Developers Coding:Beginner
    Replies: 1
    Last Post: 05-31-2011, 12:36 PM
  2. Creating GL-Sharing context with SDL
    By mollitz in forum OpenCL
    Replies: 2
    Last Post: 07-19-2010, 05:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •