[osg-users] Questions about shared compile contexts and thread safety

Kouichi Yoshizawa kouichi.yoshizawa23 at gmail.com
Sat Nov 7 15:29:18 PST 2015


Hello,

I would like to learn the status of shared compile context threads in OpenSceneGraph, as I would like to make use of them for performance reasons.  My platform is Linux with Nvidia Quadro GPUs that should have good support for shared contexts for GPU transfers.

In 2010 Robert Osfield seems to suggest that shared compile contexts are indeed supported by OSG, although GPU hardware/driver support might be lacking:


> I implemented them [ie shared compile contexts] under Linux with NVidia drivers and they worked as expected, but with other drivers and other OS's reports back from the community haven't been so positive, so it looks like it's a feature that driver developers don't put much effort in to make sure it's solid. 


However, in 2014 he seems to be discouraging their use, maybe due to thread safety issues in OSG, or am I reading this wrong?


> The OSG's is written to handling multi-theading of shared contexts as
> handling this special case would require us to add lots of mutex locks
> to all OpenGL code that is setting or using OpenGL objects.
> 
> It's better to avoid shared contexts. 
> 


Inspecting the source code, of particular concern to me is the creation/deletion of GL objects.  It appears that the GL object orphan list is accessed without mutual exclusion, from the flush functions as well as the orphan reuse functions during object creation.  Therefore these two operations must then never be performed in different threads, but if they are only called from the same thread (the compile context thread in my case) is thread safety then guaranteed?  I would be very grateful for clarifications regarding this.

Thank you!

Cheers,
Kouichi[/quote]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=65576#65576








More information about the osg-users mailing list