Results 1 to 3 of 3

Thread: Sharing Renderbuffer OpenGL object with OpenCL

  1. #1
    Junior Member
    Join Date
    Sep 2009
    Posts
    14

    Sharing Renderbuffer OpenGL object with OpenCL

    My application render the image in a OpenGL FBO.
    Then I have attached an OpenGL Renderbuffer to this FBO.

    I have created an Image2D OpenCL memory object with clCreateFromGLRenderbuffer
    Now my Kernel use an Image2D as input from the Renderbuffer.

    My question is the following, is the OpenCL memory object up to date when I call glFlush or do I need
    to call an OpenCL function to tell that the Image2D memory object must be updated with the content of the OpenGL Renderbuffer ?

    I have seen that I need to acquire and release the memory object which is shared with an OpenGL object,
    but I don't have seen anything to update the memory object from the renderbuffer.

    Anyone has any explanations ?

    Thanks

  2. #2
    Junior Member
    Join Date
    Sep 2009
    Posts
    14

    Re: Sharing Renderbuffer OpenGL object with OpenCL

    I reply to myself for all readers !

    The OpenCL memory object shared with an OpenGL Renderbuffer is always up to date. No need to acquire and release the GL object, and no need to call any cl function.

  3. #3

    Re: Sharing Renderbuffer OpenGL object with OpenCL

    I'd certainly put the clAcquire/Release in, otherwise the GL operations may not have completed writing to the FBO before your kernel starts reading it.

    It's not a case of the memory object needing to be updated from the FBO, because the memory object is the FBO. What might happen is that if you don't acquire the resource then the CL operation and the GL operation might run in parallel, so your input buffer will change as the kernel is running.

    This is unlikely on your current system as you're using the same resource to do both jobs, so it has to serialise, but in the future it may not, and I would make for a nasty bug to find.

    That's my understanding at least.

Similar Threads

  1. Replies: 3
    Last Post: 08-20-2010, 03:30 PM
  2. Replies: 5
    Last Post: 09-23-2009, 11:19 PM

Posting Permissions

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