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.

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.

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.

[QUOTE=AHeumann;1255082]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.[/QUOTE]
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.

Good plan. Unless the contexts map to different GPUs, the performance isn’t likely to be so good.

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.