Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: Please make FBOs shared across different contexts

  1. #1
    Junior Member Regular Contributor
    Join Date
    Mar 2009
    Location
    California
    Posts
    188

    Please make FBOs shared across different contexts

    Managing FBOs in a program with multiple contexts is painful. On Windows I create an OpenGL context on a hidden window and switch back to this when calling FBO commands. (On Mac, an OpenGL context on a hidden window is invalid, but FBOs do appear to be shared across contexts.) Things would be much more straightforward if FBOs were shared across contexts like VBOs, textures, and shaders are.

  2. #2
    Junior Member Newbie
    Join Date
    Jan 2013
    Posts
    11
    The reason that FBOs are not shared is that they are container objects only. But the renderbuffer or texture objects representing the buffers are shared.

    Just create FBOs for each context and attach the shared renderbuffer/texture objects.

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Apr 2009
    Posts
    578
    There is a really simple, nasty API reason that FBO's are not shareable across contexts: using and editing them is binding them. Specifically, if FBO's where cross-context there are icky things where context A edits the FBO (by changing attachments or changing to what buffers to render) and context B is rendering using that same FBO. One can declare that FBO edits from another thread and context do not take effect until rebind, but that just adds more ickiness in the long run.

    The story is similar for VAO's too.

  4. #4
    Junior Member Regular Contributor
    Join Date
    Mar 2009
    Location
    California
    Posts
    188
    Quote Originally Posted by AHeumann View Post
    The reason that FBOs are not shared is that they are container objects only. But the renderbuffer or texture objects representing the buffers are shared.

    Just create FBOs for each context and attach the shared renderbuffer/texture objects.
    That is a data management nightmare. What would I do, have an std::map as a member of my render buffer class with a VBO for each context...binding textures each time a new context/vbo combo is encountered. That would be a horrible mess.

    One can declare that FBO edits from another thread and context do not take effect until rebind, but that just adds more ickiness in the long run.
    I never render multiple contexts simultaneously. Didn't even know it was possible.

  5. #5
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,126
    Quote Originally Posted by JoshKlint View Post
    I never render multiple contexts simultaneously. Didn't even know it was possible.
    Good plan. Unless the contexts map to different GPUs, the performance isn't likely to be so good.

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,138
    This, together with the 'Request: FBO can use "default" color, depth and stencil buffers' thread, seems to me to be related requests for what is deep-down really the same feature - breaking apart the "FBO as container object" concept and allowing binding of the individual components in isolation.

Posting Permissions

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